Java Platform, Standard Edition Troubleshooting Guide
Contents    Previous    Next

10.5 Memory Leaks

This section first describes how to troubleshoot memory leaks and then presents some possible sources of memory leaks and provides workarounds.

To get more information on a memory leak, execute java with the heap profiler active as shown in Example 10-2. Specify that the output should be generated in binary format so that you can use the jhat utility to read the output.

For more information on troubleshooting memory leaks, as well as descriptions of the jhat utility and other troubleshooting tools that are available, see the Java SE HotSpot VM Troubleshooting Guide.

The following issue is addressed:

  • Issue 1: Memory leak in application

    Cause: Frames and dialogs are sometimes not being garbage-collected. This bug will be corrected in a future version of Java SE.

    Workaround: Known memory leaks occur in cases when the system starts to transfer focus to a focusable top-level element (window, dialog, frame), but the element is closed, hidden, or disposed of before the focus transfer is complete. Therefore, the application must wait for the focus transfer operation to finish before closing, hiding, or disposing of the element.


    Note:

    This problem normally occurs only when these actions are performed programmatically, since the user typically cannot physically perform these actions fast enough to cause the problem.

Contents    Previous    Next

Copyright © 1993, 2024, Oracle and/or its affiliates. All rights reserved.