Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Memory usage by Java program in LINUX machine.

 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Java program that I run in LINUX machine:

/usr/lib/jvm/java/bin/java -classpath .:..... -mx2m MyJavaProgram

I want to analyze the memory usage used by this program

This article (http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html ) recommends "pmap" to get more accurate picture [please see code snippet for result]. It mentions that I need to look at the "writeable/private" at the bottom of the result of running pmap command. I'm really confused why it is using 225,024K. Why is this?
Originally, I thought capping the heap size would help, but I don't understand why that much memory is being used.

 
Venkat Sadasivam
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A few years back I tried with YourKit profiler it has neat GUI to present data.
 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Venkat,

Thanks for your reply. I actually already use VisualVM from Java to monitor this.

Another example, I run another Java program with -mx2m option but the writeable/ private almost 140M (based on the link that I sent to you I need to look at the writeable/ private)...

So I'm confused ... it's Java actually use more memory thatn what's in heap and stack?

Should I transfer this question to Linux forum probably?
 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even the smallest program like this:




has huge "writeable/private" number --> more than 100MB.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic