This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 199392

Summary: Memory Leak - Dangling references to JTextFields from sun.awt.X11.XInputMethod field needResetXICClient
Product: ide Reporter: honza.hubeny
Component: PerformanceAssignee: Tomas Hurka <thurka>
Status: RESOLVED WONTFIX    
Severity: normal CC: chemFelix, jglick
Priority: P2    
Version: 7.0   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: The netbeans RCP test suite to reproduce the problem
requested java heap dump

Description honza.hubeny 2011-06-14 07:34:58 UTC
Created attachment 108886 [details]
The netbeans RCP test suite to reproduce the problem

This bug was tested on following configuration:

java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

netbeans IDE & platform 7.0

OS: Linux kernel version 2.6.38

Java L&F: metal


Bug description:

In the attachment is simple test suite with test module. The test module contains one top component which is automatically opened on the startup of the RCP application. The top Component contains JTextField and JFormattedTextField. After the application start click with mouse to the JTextField or to the JFormattedTextField. When the text field has focus close the top component. After closing the top component click on the memory panel in order to invoke the garbage collection.
After the garbage collection analyze the java heap with jmap and jhat utils (see the script java_mem_leak.sh in the attachment). You can see that the MemLeakTopComponent is still on the heap. When you check the root set references you can see that the cause is the reference from sun.awt.X11.XInputMethod field needResetXICClient to the jTextField or JFormattedTextField (see the atached memleak.html page). 

I suppose that the needResetXICClient field is not correctly cleared when the MemLeakTopComponent is closed. When you open several MemleakTopComponents and close them all, only the last top component remains in memory.
Comment 1 Tomas Hurka 2011-06-16 11:21:12 UTC
Can you attach compressed heap dump? Note also that you can use NetBeans to analyze the heap dump instead of jhat.
Comment 2 honza.hubeny 2011-08-04 06:11:00 UTC
Hi,

I'm sorry to not respond for a long time. I have attached the heap dump. The heap dump was created after closing the MemLeakTopComponent and after invoking the garbage collector (as was described in the first bug comment). 

Meanwhile I changed a little bit the testing envornment:

java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

netbeans IDE 7.0.1, rcp platform 7.0

OS: Linux kernel version 2.6.38

Java L&F: metal
Comment 3 honza.hubeny 2011-08-04 06:16:28 UTC
Created attachment 109784 [details]
requested java heap dump
Comment 4 Jaroslav Tulach 2011-08-15 12:52:26 UTC
Reported as http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7079260
Comment 5 Tomas Hurka 2011-09-12 07:53:54 UTC
Closing as wontfix. The problem is in JDK and should be fixed there.
Comment 6 Stanislav Aubrecht 2012-11-14 10:28:06 UTC
*** Bug 205254 has been marked as a duplicate of this bug. ***
Comment 7 Stanislav Aubrecht 2014-07-10 11:58:27 UTC
*** Bug 245072 has been marked as a duplicate of this bug. ***