permaculture playing cards*
The moose likes Performance and the fly likes Java application Memory Leak Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Performance
Bookmark "Java application Memory Leak" Watch "Java application Memory Leak" New topic
Author

Java application Memory Leak

Prem Chandiran marimuthu
Greenhorn

Joined: Jul 09, 2013
Posts: 2
Hi All,
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?.

PID USER PR NI VIRT RES SHR S %CPU MEM TIME+ COMMAND
15358 root 16 0 1237m 108m 8660 S 36 1.3 22:23.28 java -jar SCC.jar
15358 root 16 0 1242m 114m 8660 S 38 1.4 45:50.99 java -jar SCC.jar
15358 root 16 0 1245m 120m 8660 S 40 1.5 69:05.29 java -jar SCC.jar
15358 root 16 0 1246m 115m 8660 S 42 1.4 92:14.87 java -jar SCC.jar
15358 root 16 0 1251m 131m 8660 S 34 1.6 115:13.67 java -jar SCC.jar
15358 root 16 0 1251m 117m 8660 S 40 1.4 138:25.46 java -jar SCC.jar
15358 root 16 0 1251m 118m 8660 S 42 1.5 161:40.01 java -jar SCC.jar
15358 root 16 0 1251m 120m 8660 S 36 1.5 184:22.90 java -jar SCC.jar
15358 root 16 0 1251m 125m 8660 S 36 1.6 207:05.78 java -jar SCC.jar
15358 root 16 0 1251m 114m 8660 S 36 1.4 229:45.79 java -jar SCC.jar
15358 root 16 0 1251m 115m 8660 S 38 1.4 252:30.44 java -jar SCC.jar
15358 root 16 0 1251m 115m 8660 S 38 1.4 275:28.83 java -jar SCC.jar
15358 root 16 0 1251m 127m 8660 S 36 1.6 298:27.71 java -jar SCC.jar
15358 root 16 0 1251m 116m 8660 S 38 1.4 321:23.06 java -jar SCC.jar
15358 root 16 0 1252m 128m 8660 S 44 1.6 343:01.24 java -jar SCC.jar
15358 root 16 0 1254m 116m 8660 S 28 1.4 363:40.06 java -jar SCC.jar
15358 root 16 0 1256m 124m 8660 S 38 1.5 384:09.08 java -jar SCC.jar
15358 root 16 0 1258m 137m 8660 S 38 1.7 404:35.57 java -jar SCC.jar
15358 root 16 0 1260m 116m 8660 S 36 1.4 424:58.73 java -jar SCC.jar
15358 root 16 0 1262m 125m 8660 S 36 1.5 445:28.48 java -jar SCC.jar
15358 root 16 0 1264m 114m 8660 S 2 1.4 446:32.20 java -jar SCC.jar
15358 root 16 0 1264m 113m 8660 S 0 1.4 446:34.64 java -jar SCC.jar
15358 root 16 0 1264m 113m 8660 S 0 1.4 446:36.82 java -jar SCC.jar
15358 root 16 0 1264m 113m 8660 S 0 1.4 446:38.95 java -jar SCC.jar
15358 root 16 0 1264m 114m 8660 S 0 1.4 446:41.10 java -jar SCC.jar


Regards,
Prem
Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 417
    
    2

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
Greenhorn

Joined: Jul 09, 2013
Posts: 2
Hi chris,,
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.

Thanks,
Prem
Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 417
    
    2

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).
Tai Truong
Greenhorn

Joined: Oct 16, 2012
Posts: 4

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
 
GeeCON Prague 2014
 
subject: Java application Memory Leak