Finding memory leaks
Rutger Ovidius
ovid@mailandnews.com
Sun Feb 29 00:58:00 GMT 2004
Hi,
Yes, your test case collects ram properly on my system. I have made
many such test cases. GCJ is great at collecting ram in all my test
cases. But, when I write/release a full app and get feedback about it
using hundreds of megs of ram, and experiencing this myself only when
it is compiled with gcj it becomes difficult to figure out the cause.
I profiled the app in java (borland profiler) and didn't find any
leaks. I included System.gc()'s at strategic points, but it doesn't
seem to have an affect.
I'd really like to know where the memory is going, but I dont know how
to figure this out. GC_PRINT_STATS just tells me about an ever growing
heap, but not why it is growing or what is on it.
Regards,
Rutger Ovidius
On Saturday, February 28, 2004, Andrew Haley wrote:
> Does a trivial app (concatenate a ton of strings, throw a way the
> result, loop) collect OK for you? It does for me.
> public class gc
> {
> static public void main (String[] s)
> {
> for (int i=0; i<100000; i++)
> {
> String zz = " ";
> for (int j=0; j<20; j++)
> zz += zz;
> }
> }
> }
> There is always a risk that because of conservative collection we're
> incorrectly marking a few objects, but that doesn't sound exactly like
> the problem you're having.
> I've been thinking about this. What we really need is a mode that
> prints out every object found during the sweep in such a way that you
> can see how everything has been reached.
> Andrew.
More information about the Java
mailing list