• Post Reply Bookmark Topic Watch Topic
  • New Topic

RSS vs allocated heapsize  RSS feed

 
Ronny Chan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Sun JDK 1.4.2_03 and Resin 2.1.12. I have an application and a website running and somehow RSS seem to be more eager to grow than to drop.
RSS seem to grow if more memory is being allocated for the heap, but even when the heapsize and amount of free memory in the heap both return to their original sizes after some activity, the RSS doesn't seem to shrink back to it's original size, why is that? What or where is the difference between the amount of memory indicated by RSS and the heapsize of the JVM?
For example, the JVM's heap usage varies between 2 and 55 mb and eventually drops back to 25 mb with the allocated heapsize at 30 mb. Why is the RSS at the incredible size of 135 mb and never returns to, say, 70 mb.
My JVM-options are:
-Xmx192M -Xms10M -XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=10
Note: lowering -Xmx does not restrict growth of RSS unfortunately.
 
Tim Holloway
Saloon Keeper
Posts: 18799
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm afraid I'm not an expert in the internals of Sun's JVM, but you may be able to use an alternate JVM that employs a different strategy. Sun's not the only game around.
Actually, you might want to check the IBM DeveloperWorks site out. They publish some real interesting things on down-and-dirty.
Let us know what you find out!
 
Ronny Chan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Several JVMs are available for Linux like Sun, IBM, Blackdown and JRockit. My experience so far is that especially Blackdown and Sun use up the least memory and in my case I experience greater performance and less memory usage when I don't use the server-option for JVMs.
As for the growing gap between the actual size used up by the JVM and the heapsize used according to the JVM (i.e. total mem minus free mem), it should be one of the following reasons:
  • not closing resources, esp. database connections, statements and resultsets
  • writing native code that has a memory leak or
  • using a third party component or a JVM that has one of the previous two problems


  • If anyone has anything to add about this, please feel free to post it here.
     
    Ronny Chan
    Greenhorn
    Posts: 5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks to a reply at another forum I found out that using java.io.File.deleteOnExit() in conjunction with a webserver may result in a memory leak since the JVM exits when the webserver is stopped or restarted. Meanwhile the JVM collects information about files that can be deleted, ergo memory gets filled. Of course if you don't use deleteOnExit() often in your webapps, it shouldn't be a problem, but keep this behaviour in mind though.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!