Debugging memory leaks
Andrew Haley
aph@redhat.com
Wed Apr 20 15:44:00 GMT 2005
Hans Boehm writes:
> Unfortunately, you currently have to rebuild libgcj to get this
> functionality. You need to build with --enable-gc-debug.
Okay. Is this disabled by default because it harms performance?
> If you are debugging an application that can be made to leak most of
> the memory in its heap, you can usually get the information you want by
> setting the GC_BACKTRACES environment variable to a small integer. This
> will print the indicated number of backtraces from random addresses at
> each pc.
>
> If you need something more specific, look at gc_backptr.h. You should be
> able to use this directly from a debugger. But watch out for unintended
> reflection: It's easy for this stuff to accidentally find "pointers" from
> your debugging code itself.
I'll have a look.
Andrew.
> On 2005年4月15日, Andrew Haley wrote:
>
> > I've been having a great deal of difficulty tracking down memory leaks
> > in libgcj.
> >
> > What I need is some sort of interface that allows me to enquire who
> > points to an object. The ideal interface would be something like
> > points_to (obj) -> obj. I realize that in practice there is a set of
> > objects that point to a particular object, but that doesn't concern
> > me: one is all I need.
> >
> > Is there any interface within the GC that can give me this function?
> > If not, how hard would it be to provide? Can you provide me with some
> > guidance?
> >
> > Ideally, I'd love to have something like Glasgow Haskell Compiler's
> > heap profiling, but I'll settle for much less.
> >
> > Thanks,
> > Andrew.
> >
More information about the Java
mailing list