FWD: [gclist] memory leaks & Boehm collector

Bill Foote Bill.Foote@Eng.Sun.COM
Fri, 16 Jul 1999 16:52:08 -0700 (PDT)

> Delivered-To: majordom-gclist-out@iecc.com
> Date: Thu, 15 Jul 1999 10:48:28 +1000
> From: Fergus Henderson <fjh@cs.mu.OZ.AU>
> To: Garbage Collection mailing list <gclist@iecc.com>
> Cc: Mercury Developers <mercury-developers@cs.mu.OZ.AU>
> Subject: [gclist] memory leaks & Boehm collector
> Mime-Version: 1.0
> [....]
> I seem to recall Hans mentioning something about how it would be nice
> to have a tracing tool that would take an arbitrary address and, if the
> address was live, would give you back a trace showing the chain of
> pointers from one of elements of the root set to that address.  Did
> anyone ever get around to writing such a tool?
> P.S. I'm using gc-4.14 on a dec-alpha-osf3.2 system, with egcs-1.1.2.

Hi.  I haven't been a member of either of these lists, but this e-mail got
forwarded to me, and I thought I'd comment.

I made exactly such a tool for the JDK.  Instead of trying to run with
a live VM, I made the VM dump a file that contains essentially an image 
of the Java object heap.  It was originally a weekend hack, but the
functionality  was picked up into JDK 1.2, and became the heap dump 
record of JVMPI (the Java Virtual Machine Profiler Interface).  This is 
being used by tools like OptimizeIt to do all kinds of neat stuff, including
(I'm told) the query you describe.  BTW, this was inspired by an earlier
facility in JavaOS, which did operate on a live VM.

I also hacked together a little tool that reads these dump files, and lets
you do various queries on it.  The most interesting query is exactly
the one you describe, and I call it "reference chains from rootset."  When
building up the chain of pointers, one thing I found is that it's really
important to do the upward search for roots breadth first -- it's obvious
why when you think about it, and quite amusing when you don't :-)

Anyway, if anyone wants to see how this turned out in a Java context, check
out http://java.sun.com/people/billf/heap/ .


Bill Foote                                  bill.foote@eng.sun.com
EmbeddedJava Platform Group, Sun Micro      http://java.sun.com/people/billf/