United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4928472 Should not call GC when AWT encounters an out of memory error
JDK-4928472 : Should not call GC when AWT encounters an out of memory error

Details
Type:
Bug
Submit Date:
2003-09-25
Status:
Resolved
Updated Date:
2010-02-01
Project Name:
JDK
Resolved Date:
2005-08-21
Component:
client-libs
OS:
windows_xp,windows
Sub-Component:
java.awt
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.2_17,6
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
In awt_new.cpp, AWT has a handler for memory allocation.  When an allocation 
fails (either malloc or new), this handler is invoked.  It tries to compact 
the heap by invoking the garbage collector, and if successful, tries the 
memory allocation again.  This may have made sense in the days when we were 
using the Symantec JIT, but it doesn't anymore.  In fact, it has caused 
problems for the VM team.  They have asked that the handler be removed.  

Throwing an OutOfMemory Exception is fine, but invoking the garbage collector 
is not.  

The handler function is: 

// Called when malloc or operator new runs out of memory. We try to
// compact the heap by initiating a Java GC. If the amount of free
// memory available after this operation increases, then we return
// (1) to indicate that malloc or operator new should retry the
// allocation. Returning (0) indicates that the allocation should fail.
int
NewHandler::handler(size_t) {

                                    

Comments
EVALUATION

Should try to fix for 1.5.1.  
###@###.### 2003-09-25
                                     
2003-09-25
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mustang


                                     
2004-09-08
EVALUATION

See description.
                                     
2005-07-29
SUGGESTED FIX

Remove the context of NewHandler::handler almost completely, leave only error message
                                     
2005-07-29



Hardware and Software, Engineered to Work Together