GC leaks debugging

Erik Groeneveld erik@cq2.nl
Sun Apr 3 17:15:00 GMT 2011

On Sat, Apr 2, 2011 at 11:38 AM, Erik Groeneveld <erik@cq2.nl> wrote:
>> Note that in the information you posted, the GC was scanning around 7.5MB of roots conservatively.  It might be worth checking what those regions are.
> It seems it come from libgcj.  This is now my minimal program:
> #include <gcj/cni.h>
> void _Jv_RunGC(void);
> int main(int argc, char *argv[]) {
>    JvCreateJavaVM(NULL);
>    _Jv_RunGC();
>    //JvAttachCurrentThread(NULL, NULL);
> }

With GC_DUMP_REGULARLY it logs an empty heap just before
JvCreateJavaVM and right after it:

***Static roots:
From 0x8049bdc to 0x8049d34  (temporary)
From 0xb714c000 to 0xb787dcdc  (temporary)
Total size: 7544372

Using gc-analyse's memory map, I find the first root to be in this
block of 4 kB. Probably my own data segment or stack:
8049000-804a000 -> .../minimal/test offset 0

The second root spans the next block of 6792 kB and most of the
following block of 584 kB:

b714c000-b77ee000 -> .../gccinstall-def/lib/libgcj.so.12.0.0 offset 1b3a000
b77ee000-b7880000 -> TestDump001.bytes offset b0009c

The heap itself is only 368 kB and contains lots of static strings,
classes etc. Nothing special AFAICS.

So I am now off into JvCreateJavaVM, if you have any thoughts, please
let me know.

More information about the Java mailing list