• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Java application Memory Leak

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 443
3
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Prem Chandiran marimuthu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 443
3
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Greenhorn
Posts: 4
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic