JDK-5105884 : JVM should return memory back to the Operating System
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-09-22
  • Updated: 2005-09-01
  • Resolved: 2005-09-01
Related Reports
Duplicate :  
Description
Name: rmT116609			Date: 09/22/2004


A DESCRIPTION OF THE REQUEST :
The memory usage of the JVM should be dynamic. The "-Xmx" option just sets a maximum limit. If the application exceeds this limit an OutOfMemoryError occurs. Once occupied memory is not returned back to the operating system. For multithreaded server applications, this can easily lead to an OutOfMemoryErrror and the application basically crashes (because it can't perform the tasks without memory).


JUSTIFICATION :
If the JVM would take as much memory as it can get from the OS (only if required), there would be no need for the fixed "-Xmx" maximum memory option. If the JVM would return unused memory back to the operating system, the application would just have some times that it uses much memory (eventually slowing down the server through swapping) and afterwards performs nicely again (because it doesn't need to swap anymore).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Memory usage of java applications (java.exe) not only increases but also decreases.
ACTUAL -
Memory usage of java applications just increases (perhaps leading to an OutOfMemoryError), with the result that other applications on the server get less memory and never have a chance to get more.
(Incident Review ID: 311498) 
======================================================================