[Gc] GC Warning: Repeated allocation of very large block

Andrew Haley aph at redhat.com
Tue Oct 31 02:31:32 PST 2006


Boehm, Hans writes:
 > Unfortunately, it's debatable whether the collector runs perfectly
 > correctly when this happens.  This message is only printed if the
 > collector has significant reason to believe that you will be leaking
 > large blocks of memory, as a result of  allocating objects larger than
 > what it can place between known "false pointers".  

So, does this only happen if the gc can't mmap() somewhere else?

 > Hence the block will be allocated, but is likely to remain pinned
 > for the rest of the process.  Things will continue to work for a
 > while, but often not indefinitely.

Well, look at this from a user's point of view.  All that the Java
code does is allocate a very large array of ints.  That's a perfectly
proper thing to do, if somewhat unusual.

 > I think the warning is currently only printed after allocating 5
 > such blocks, suggesting that this is being repeated often enough to
 > be a serious issue.  You might look at the GC_PRINT_STATS log to
 > see whether it really appears benign.  Repeated sequences of heap
 > expansions without an intervening GC are generally suspicious.
 > 
 > If you are seeing this on a 64-bit machine, we should investigate.
 > On a 32-bit machine, this is unfortunately hard to avoid in
 > general.  We could see where the false references are coming from,
 > and try to avoid those.  But I think there's no easy way out.
 > 
 > You should also remember that allocating a 2MB block in a
 > garbage-collected setting is expensive, no matter what the
 > collector.  The collector cost is roughly the same as allocating
 > 20,000 100-byte blocks.  If you are allocating a bunch of these in
 > a row, it's probably worth thinking about ways to avoid that.

Sure, but I didn't write the application, and the garbage collector
gives me no way to know what the cause of the problem might be.  All
that users of gcj know is that when run on other people's Java systems
they don't get this message.  They think it's a bug in gcj.  And hey,
that's how it looks to me too.

Andrew.


More information about the Gc mailing list