United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6434648 native memory leak when use Thread.getAllStackTraces()
6434648 : native memory leak when use Thread.getAllStackTraces()

Details
Type:
Bug
Submit Date:
2006-06-06
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
core-svc
OS:
windows_xp
Sub-Component:
java.lang.management
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
7

Related Reports
Backport:
Relates:

Sub Tasks

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);
>   }
                                     
2006-11-10
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
                                     
2006-11-07



Hardware and Software, Engineered to Work Together