I'm trying to generate a sitemap for my public facing SharePoint 2010 sites. I've basically found 2 approaches, the first, you grab the root SiteMapNode and then go from there. The other approach is to grab the root Web, get the publishing pages, then navigate through the web hierarchy. There are advantages and disadvantages to both, for instance method 1 is including non-publishing content, which we like, but it isn't obvious how I might check to see if a page is published. Method 2 is missing static HTML that method 1 doesn't, but I can check if the page is published, and it takes TONS less memory.
Is one "better" than the other? Pursuing option 1 first I've tried everything I can think of to reduce memory usage, eliminating recursion, etc. For GOOD examples of what I'm doing you can look at the Waldek Mastykarz's blog for option 1, and one that was suggested to me by our Microsoft rep as option 2.
One thing to keep in mind for my personal situation, I have like a gazillion subsites, each with several pages, ok, maybe that's a slight exaggeration, but I do have over 2300 subsites and 16000+ pages. I've run SPDispose tool and it says I'm all clean, but I'm basically chewing up something like 5 gig of ram to generate a sub-1 MB xml file, and I've no idea what is doing it.