United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7124524 [macosx] OutOfMemory exception after (or even before) some 2500 creations of LWWindowPeer
7124524 : [macosx] OutOfMemory exception after (or even before) some 2500 creations of LWWindowPeer

Details
Type:
Bug
Submit Date:
2011-12-23
Status:
Closed
Updated Date:
2012-10-09
Project Name:
JDK
Resolved Date:
2012-02-29
Component:
client-libs
OS:
os_x
Sub-Component:
java.awt
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
7u4

Related Reports
Duplicate:

Sub Tasks

Description
http://java.net/jira/browse/MACOSX_PORT-676 submitted 2011/11/09 by Yuri Nesterenko
Build: b216
closed/java/awt/Frame/RemoveNotifyTest/RemoveNotifyTest
This old test run a loop constructing 500 Frames with MenuBar defined; for each one, show()/removeNotify() is called 5 times. Thus, net result should be, nothing on the screen.
However, somewhere in the process we receive an OutOfMemory exception in 2D call from  initalization section of  LWWindowPeer: 
 // Create surface data and back buffer
 replaceSurfaceData(1, null);
I don't know if it is AWT or 2d issue and send this to AWT (traditionally, would say in AWT).
The test (2 files) and a log snippet attached.

                                    

Comments
SUGGESTED FIX

http://hg.openjdk.java.net/jdk7u/jdk7u-osx/jdk/rev/36f7b80cdb5a
                                     
2012-01-26
EVALUATION

This is a fix for 3 memory leaks.
1. LWWindowPeer does not destroy backbuffer in disposeImpl().
2. LWToolkit stores unused links to Peer.
3. Local references were not deleted in the AWTWindow.m, but according JNFJObjectWrapper.jObjectWithEnv documentation "returns a new local-ref, must be released with DeleteLocalRef".
                                     
2012-01-26



Hardware and Software, Engineered to Work Together