|
Quick Lists
|
|
Bug ID:
|
6411042
|
|
Votes
|
0
|
|
Synopsis
|
AWT Memory Leak
|
|
Category
|
java:dragndrop
|
|
Reported Against
|
b01
|
|
Release Fixed
|
7(b03)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
6407026
|
|
Submit Date
|
10-APR-2006
|
|
Description
|
Problem: Leak of java.awt.Panel when components created from SWT event thread
Environment: Windows XP (SP2)
JDK 1.5.0_06 (also seen with 1.4.2_09)
SWT 3.1.2
Unzip the attached application (ZQJleak.zip file), and run the following command from its main directory:
java -Djava.library.path=org.eclipse.swt -classpath TableExample;org.eclipse.swt\swt.jar SimpleTableDemo
After about 15-20 iterations it will throw an OutOfMemoryError.
Profiling with JProbe indicates that the Panel customer is getting pinned by a JNI global reference.
I've only been able to reproduce this problem when the components are created in an SWT event thread, but note that the AWT/Swing components themselves are not embedded in SWT. The same code does not leak if the components are created from any other thread.
Also, the leak will go away if the JTable.setDropTarget() is called with a null argument right after the table is created.
Posted Date : 2006-04-10 16:43:24.0
|
|
Work Around
|
N/A
|
|
Evaluation
|
in fact the problematic code is registering DropTarget on JTable.
So to remove all Swing code we need to create DropTarget for panel
instead of creating JTable.
It is an instance of AwtDropTarget who has a reference to the panel.
This instance it not released because m_refs (reference counter) is not 0.
For some reason OLE calls AddRef() more time than Release().
I suspect that this is bacause SWT calls OleInitialize() on its thread, which assumes
that we use single-threaded apartment. We also call this function on Toolkit thread.
And we use AwtDropTarget from both threads and this is vilation of single-threaded
apartment.
Perhaps we should use InvokeFunction() instead of SyncCall() for
Java_sun_awt_windows_WComponentPeer_addNativeDropTarget() and
Java_sun_awt_windows_WComponentPeer_removeNativeDropTarget()
Posted Date : 2006-05-10 02:01:21.0
Replacing SyncCall() with InvokeFunction() resolve the problem.
Need to think if this is enough, or we should call InvokeFunction()
from SyncCall().
Posted Date : 2006-05-10 02:36:43.0
umbrella fix from 6407026
Posted Date : 2006-10-02 08:19:39.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |