I was running an java application in unix machines , during load for 20 hrs in last 5 hrs every 1 hour virtual memory is increasing by 2 MB though RES memory is stable so my friend is saying the application has memory leak..below is a hour wise load stat using top command. my question is 1.) whether increase in virtual memory means memory leak? 2.) Which column in top stats has to be considered for memory usage?.
What are your JVM parameters do you have set eg Xmx and Xms set and are they equal to each other ? ie have you let Java grow its heap.
If they are are set and equal then ...
Have you tried collecting you GC log and graphing it ? then take a hprof a the end and do an eclipse MAT leaks suspects report.
If you force a full GC does it drop back.
If not set equal then ...
Number of threads ? Stack sizes ? XSS setting for instance ?
"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
Prem Chandiran marimuthu
Joined: Jul 09, 2013
Thanks for your reply. Xmx and Xms are not set. My question whether increase in Virtual memory can be considered as memory leak. since most of the time we measure only RES memory. Please suggest me.
I would personally be watching the virtual memory total rising with regards to potential leaks .
Given your JVM settings or lack of and the figures your showing me I can't say if you have a leak or not. If you are at all concerned about leaks I would strongly suggest you collect GC logs and plot them using something like gcviewer. In an application concerned with performance I would normally expect you to set Xmx/Xms (and to the same value).
You can use the flag "java -XX:+PrintFlagsFinal" to show all possible flags and it also prints all the default values for the flags being set. For details see here: JVM Memory Arguments For a verbose gc output you can use "-verbose:gc". Details see here: garbage collection - part 1 and 2