I've got a big app and I need a tool that can quickly help me locate a
memory leak. Luckily, the app can run in a fast mode (60x), so
one option is to run it with JRocket and use the Leak Detector.
(The developer license allows me to run it for one hour, which is enough
time for the leak to appear running in fast mode).
Are the any other neat tools for this.
Thanks.
Lordy
Zoli - 22 Jul 2006 15:45 GMT
Try JProfiler!
Z
> I've got a big app and I need a tool that can quickly help me locate a
> memory leak. Luckily, the app can run in a fast mode (60x), so
[quoted text clipped - 6 lines]
> Thanks.
> Lordy
bowman - 22 Jul 2006 16:32 GMT
> Are the any other neat tools for this.
Valgrind on Linux. There is a note in the FAQ about dynamically generated
code and a flag.
lordy - 22 Jul 2006 18:37 GMT
>> Are the any other neat tools for this.
>
> Valgrind on Linux. There is a note in the FAQ about dynamically generated
> code and a flag.
Thanks, but I think this only works at the System heap memory level. I
want to find Java objects that are not getting GC'ed and why..
Cheers,
Lordy
Nick Vatamaniuc - 24 Jul 2006 06:58 GMT
Lordy,
Please see this the GC Portal on java.sun.com.
http://java.sun.com/developer/technicalArticles/Programming/GCPortal/
There is way to run the JVM with the verbose GC options for example:
-verbose:gc
-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails
There you will also find references to visualgc and jvmstat
http://java.sun.com/performance/jvmstat/visualgc.html
http://java.sun.com/performance/jvmstat/
A quick and dirty way is to test the limits of your program is to
stress test it. For example instead of having it run for 10 minutes and
creating 1000 objects as normally does, have it run for 5 hours and
create 1000000 objects and just look at your memory. It is just sort of
a real-life testing. If your program works will under x100 the 'normal'
conditions, it is probably 'good enough'. In other words you could
spend 2 days finding 'leaks' and tunning the GC only to get a tiny
performance boost - it might not be worth it altogether, but you would
know better of course...
Hope this helps,
Nick Vatamaniuc
> >> Are the any other neat tools for this.
> >
[quoted text clipped - 6 lines]
> Cheers,
> Lordy
lordy - 27 Jul 2006 01:09 GMT
> Lordy,
>
[quoted text clipped - 20 lines]
> Hope this helps,
> Nick Vatamaniuc
Thanks for that. I did observe the lean during a stress test. I just
wanted a quick way of pinpointing the hanging references. It turns out
that some resultSets were not getting closed. Found using JRockit
memory leak tools.
Lordy
pranshu - 24 Jul 2006 13:02 GMT
Hi Lordy,
If you know there is a memory leak and have the steps to reproduce it,
then you have good tools. Essentially, you need to look for profilers
which can do memory profiling ( most of them do) - like Jprobe which I
have used and found to be good.
You have to setup the application to profile using the profiler,
execute the steps for the first time manually,call GC , take a
snapshot of memory, execute the same steps for the second time
manually, call gc again and take a snapshot again. Now if you diff the
two snapshots you will know which are the culprit objects. The first
step is necessary so that you donot count cached objects or the ones
you want to live in memory.
If you donot know if there is a memory leak, then it will be best to do
a performance test by recording the frequently used scenarios and
executing a load test over time.
You will need to look at the memory utilization of the JVM and see if
it is consistently growing with time. It sometimes help if you can code
a JSP which explicitly calls GS and invoke that once in a while - just
so that you know which points to take in the graph.
Regards
Pranshu
lordy - 27 Jul 2006 01:10 GMT
> Hi Lordy,
> If you know there is a memory leak and have the steps to reproduce it,
[quoted text clipped - 8 lines]
> step is necessary so that you donot count cached objects or the ones
> you want to live in memory.
Useful. Thanks.
> You will need to look at the memory utilization of the JVM and see if
> it is consistently growing with time. It sometimes help if you can code
> a JSP which explicitly calls GS and invoke that once in a while - just
> so that you know which points to take in the graph.
Yup. Did that.
Lordy
Stephen Kellett - 25 Jul 2006 12:22 GMT
>I've got a big app and I need a tool that can quickly help me locate a
>Are the any other neat tools for this.
Java Memory Validator
http://www.softwareverify.com/java/memory/index.html
Stephen

Signature
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting
lordy - 27 Jul 2006 01:13 GMT
>>I've got a big app and I need a tool that can quickly help me locate a
>
[quoted text clipped - 3 lines]
>
> http://www.softwareverify.com/java/memory/index.html
Windows only :(.
Lordy
IchBin - 27 Jul 2006 01:31 GMT
>>> I've got a big app and I need a tool that can quickly help me locate a
>>> Are the any other neat tools for this.
[quoted text clipped - 5 lines]
>
> Lordy
How about the java_home\bin\jconsole.exe
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
vladimirkondratyev@yahoo.com - 27 Jul 2006 07:56 GMT
YourKit Java Profiler ( http://www.yourkit.com ) can help you to find
memory leak.
Best regards,
Vladimir