[Gc] "Too many heap Sections" using allocations that span multiple pages.

Alec Orr Alec.Orr at wbemsolutions.com
Fri Jan 4 11:40:21 PST 2008

Good Day everyone:

We are doing stress testing of a multithreaded application using the GC 6.8 on 
RH/SLES-10 Linux and Win32.  We are seeing a "Too Many Heap Sections" error on 
Win32 during stress testing, we also see this error in
real world testing but it takes several days (or week) to hit.

During stress testing, our application has a need to intermittently allocate 
very large blocks of memory (anywheres between 1 page, or as large as 200 - 500 
MB) as we build up an XML response.  Total application size can grow between
1-2GB.  We tried using LARGE_CONFIG flag and toggling the timelimit for
collections (in priv.h), but we notice this only delays the 'too many heaps'
abort we see.

We can alleviate the issue completely by coding the large blocks to come from 
another heap (the C-Runtime rather than the GC).  It appears that when a very 
large block (greater than 1 page) is returned to the GC, that the GC may use the 
large block as a new root for future, smaller allocations (please correct me if 
I am wrong here).

Is there a way to tell the GC to 'give back' blocks spanning multiple pages to 
the OS (USE_MUNMAP to target large blocks) using a threshold of some kind?

Thanks for any advice folks, and Happy New Year,

More information about the Gc mailing list