JDK-6434648 : native memory leak when use Thread.getAllStackTraces()
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-06-06
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u1Fixed 7 b03Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)
and
Java HotSpot(TM) Server VM (1.6.0-beta2-b79) for windows-x86, built on Apr  6 2006 00:23:36 by "java_re" with unknown MS VC++:1310


ADDITIONAL OS VERSION INFORMATION :
Windows XP Build 2600 Service Pack 2

EXTRA RELEVANT SYSTEM CONFIGURATION :
CPU:total 2 family 15, cmov, cx8, fxsr, mmx, sse, sse2, ht

Memory: 4k page, physical 2088300k(44748k free), swap 4019972k(1951532k free)


A DESCRIPTION OF THE PROBLEM :
The private bytes memory processus grow, when i use Thread.getAllStackTraces()



ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.OutOfMemoryError: requested 12 bytes for CHeapObj-new. Out of swap space?

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;

public class Main4
{
    public static void main(String[] args)
    {
        while (true)
        {
            Thread.getAllStackTraces();
        }

    }
}
---------- END SOURCE ----------

Comments
SUGGESTED FIX ------- threadService.cpp ------- 464a465,467 > for (int i = 0; i < _frames->length(); i++) { > delete _frames->at(i); > }
10-11-2006

EVALUATION Both Thread.getAllStackTraces() and ThreadMXBean.getThreadInfo() have memory leak to obtain stack trace. I can reproduce it with JDK 6 and 5u09. Fix it in 6u1
07-11-2006