Ronny Chan

Greenhorn
+ Follow
since Feb 27, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ronny Chan

Thanks to another forumposter 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.
16 years ago
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.
16 years ago
how can I manage to have the JVM leak memory?
some ways -visible to the JVM- are:
- making a thread live long and hold strong references to objects
- making static references to objects
some ways -invisible to the JVM- are:
- writing native code that allocates memory without deallocating it
- using databaseconnections, statements and resultsets without closing them
another way:
- using a JVM or third-party component that leaks memory for you
more ideas on how to leak memory?
[ March 03, 2004: Message edited by: Ronny Chan ]
[ March 03, 2004: Message edited by: Ronny Chan ]
16 years ago
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.
    16 years ago
    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.
    16 years ago