JDK-6392023 : Java Heap should be combined for low memory systems
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 1.4.2
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2006-02-28
  • Updated: 2013-11-05
  • Resolved: 2013-11-05
Related Reports
Relates :  
Description
The GC heap allocation code does not make full use of available memory in systems with very low physical memory.  The default reserved sizes of permgen and the java heap are too large for systems with 32MB and since these two spaces are managed separately, once the max has been reached in one space, no attempt is made to allocate in the free space of the other. 

This RFE is requesting that we use the combined total space of both the permgen and java heap when trying to detect out of memory.  This solution has been prototyped and is not very intrusive to the GC code.

Example:

In 32MB physical memory system with no swap:

a. Detect that this is a low memory system which enables the following logic:

b. set MaxPermGen to 64MB
c. set MaxHeapSize to 64MB
d. set MaxCombinedHeapSize to 16MB

Then MaxCombinedHeapSize is the limit whereby an allocation in either PermGen or JavaHeap will OOM if the sum of the capacities of both spaces is >= MaxCombinedHeapSize.  This in affect dynamically reduces the amount of reserved space in one space if the other requires more.

Capacities is defined here as the amount of committed memory allocated.

Without this type of functionality, memory in one space may go unused and cause
an OOM exception to be thrown when there was physical memory available and not
yet used in the other.