System.OutOfMemory Exception Thrown in MOSS 2007 In Place Upgrade

When upgrading a SPS2003 installation with an unusually large number of sites, the in place upgrade process may run into a condition where it runs out of memory.  The following message will appear in the upgrade.log:

 

[SPWebTemplateSequence] [ERROR] [1/15/2007 11:30:03 PM]: Template SPSPERS#0: Exception thrown in activating SPSite scoped features for SPSite with URL http://servername/personal/mysite (Id=bbbbabb-bbbb-bbbb-8f74-ee639a937347). Skipping this SPSite for template upgrade. Exception: System.OutOfMemoryException: Server Out Of Memory

There is no memory on the server to run your program. Please contact your administrator with this problem.

Try configuring the server so that it supports a web garden as outlined in this article

http://support.microsoft.com/kb/823547

This also goes for ASP.NET applications as well.  This typically can be encoutnered when the number of SPS2003 sites are greater than about 100 or so.