aspose file tools*
The moose likes Performance and the fly likes JVM process memory VS object heap memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "JVM process memory VS object heap memory" Watch "JVM process memory VS object heap memory" New topic
Author

JVM process memory VS object heap memory

sagar chandra
Greenhorn

Joined: Nov 06, 2009
Posts: 3
Hi All,

We have a webapp running on jboss. I have a 3 gig machine and my java options in run.bat script are



jvm process memory when i observed in task bar starts normal but increases over 1 gig as i do opertations on web app. And it almost never decreases even if the heap memory is decreased. I used visual VM tool to invoke the GC and the heap comes down from say 800mb to like 200 mb. But the jvm process memory is still stays where it was at,say 1.2 gig.. No decrease in JVM process memory. How do we say to JVM that if you dont need lot of memory for yourself, just release it to the OS. Increase of JVM process memory has big affect on my web app performance..

Thank you.

Sagar
Rishi Shehrawat
Ranch Hand

Joined: Aug 11, 2010
Posts: 218

In case of SUN JVM try using -XX:MaxHeapFreeRatio

http://stackoverflow.com/questions/675589/jvm-sending-back-memory-to-os

You need to be aware of the overhead of heap resize, if you use this option the number of heap resizes will increase, which might have a performance overhead.
sagar chandra
Greenhorn

Joined: Nov 06, 2009
Posts: 3
Thank you Rishi for the reply,

I have added the following options for java

-XX:MinHeapFreeRatio=30 -XX:MaxHeapFreeRatio=70

But still, I see no difference in jvm process memory size even after the GC has collected the heap garbage.

javascript:emoticon('');

Sagar
Thomas Kruse
Greenhorn

Joined: Dec 26, 2005
Posts: 14

I am suffering from similar problems, especially since the heap memory seems to not be less correlated to the total memory consumption than anticipated.

If you are running in a 64bit environment, you can safe some space by enabling CompressedOops.
Rishi Shehrawat
Ranch Hand

Joined: Aug 11, 2010
Posts: 218

Sagar, I noticed that in your server start script -Xms & -Xmx size is same.
This means that heap will always be at 1 GB & JVM will take this much of process memory no matter how much java heap is used by your application.
Decrease the -Xms option & try setting it to 512m.


You also need to do some more analysis of GC activity. You can enable GC logging, this will then give you an idea about how much heap is used,
frequency of GC, time spent on GC, etc. Based on this you can fine tune -Xms & -Xmx further.



Pankaj Kumarkk
Ranch Hand

Joined: Apr 17, 2011
Posts: 108
As far as my understanding goes, there is no concept of returning the memory back to OS.
Thus the JVM memory size will not increase once it gets memory from OS. GC affects only heap size not the JVM memory.

Please correct me if my understanding is wrong.
Rishi Shehrawat
Ranch Hand

Joined: Aug 11, 2010
Posts: 218

If -Xms = -Xmx then memory will not be returned to OS, however if -Xmx != -Xms then JVM can return/release memory back to the OS.
 
Don't get me started about those stupid light bulbs.
 
subject: JVM process memory VS object heap memory