Garbage collector question - "too many roots set"

Jeff Sturm jsturm@one-point.com
Thu May 22 13:53:00 GMT 2003


On Wed, 21 May 2003, [iso-8859-1] Øyvind Harboe wrote:
> In trying to track down a heap corruption problem (GDB has a warning
> about heap corruption), I've stumbled across a weird failure.
>
> "Too many root sets"
>
> I think my test isn't eating memory, so why does the garbage
> collector go gaga?

That message comes from the GC, indicating that the root set table has
overflowed.  It has nothing to do with memory consumption.

I suppose this is on Windows?  My guess is VirtualQuery() is running wild,
returning more results than the static-allocated root set table can handle
(MAX_ROOT_SETS, usually 1024).

Is it possible you have native code that allocates a large number of small
noncontiguous memory regions from the OS?  (As I understand the code in
GC_add_roots_inner, it should merge adjacent or overlapping regions so
they count as one region.)

Workarounds available are increasing the compile-time MAX_ROOT_SETS
constant, or disabling DYNAMIC_LOADING entirely if you can be certain that
you are static-linking you gcj libraries and no java pointers can exist in
a DLL data region.

Jeff




More information about the Java mailing list