• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JVM process memory VS object heap memory

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 218
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 14
Netbeans IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 218
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.



 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 218
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic