[Fwd: Re: Debugging memory leaks]

David Daney ddaney@avtrex.com
Sun Nov 20 23:12:00 GMT 2005


This is a message I originally sent privately to Andrew Haley, however 
it might be useful with your problem as well (and the gcj community in 
general).

David Daney

-------- Original Message --------
Subject: 	Re: Debugging memory leaks
Date: 	Fri, 15 Apr 2005 09:39:27 -0800
From: 	David Daney <ddaney@avtrex.com>
To: 	Andrew Haley <aph@redhat.com>



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.
  >

We have exactly this.  I don't think it works with the BC_ABI.  Also it
is only tested on mipsel-linux. gcj-3.4.3

The things in memorydump.tgz are linked into the application under test.
   We added it to libgcj.

memorydumpanalize.tgz analizes the dump off-line.

To generate the dump do:

com.avtrex.test.memory.GCInfo.enumerate("%03d-dump.txt");

To analize the dump do:

java -Xmx512m  com.avtrex.test.analyze.MemoryAnalyze [name_of_dump_file]

The executable image and libgcj.so must be in the current directory.
Also the name of nm (mipsel-linux-nm) is hard coded so you will have to
fix that.

The code is a bit of a hack.  If you like it I was thinking of cleaning
it up and contributing it to GCC.

More instructions:

Put all of these items in a directory:

     The memory log files. Typical example: 2 files, 001-nomem.log and
001-nomem.log.bytes

     The excutable program

     The gcj library (like libgcj.so.4.0.0 or libgcj.so.4.0.0.nomal)


Cd to that directory


Java –Xmx512m –cp analyze.jar com.avtrex.test.analyze.MemoryAnalyze
001-nomem.log


Be sure to use a full path for analyze.jar if it isn’t in the current
directory, and replace 001-nomem.log with the appropriate memory dump file.





David Daney

-------------- next part --------------
A non-text attachment was scrubbed...
Name: memorydump.tgz
Type: application/x-gzip
Size: 3585 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20051120/397e3677/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memorydumpanalize.tgz
Type: application/x-gzip
Size: 7328 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20051120/397e3677/attachment-0001.bin>


More information about the Java mailing list