Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6411042

AWT Memory Leak

XMLWordPrintable

    • b03
    • x86
    • windows_xp
    • Verified

      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 object 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.

            uta Alexey Utkin (Inactive)
            rverabel Raghu Verabelli (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: