United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4211929 It would be cool if application could trigger a heap dump
4211929 : It would be cool if application could trigger a heap dump

Details
Type:
Enhancement
Submit Date:
1999-02-16
Status:
Closed
Updated Date:
2005-12-20
Project Name:
JDK
Resolved Date:
2005-12-20
Component:
core-svc
OS:
generic,windows_2000
Sub-Component:
java.lang.management
CPU:
x86,generic
Priority:
P5
Resolution:
Duplicate
Affected Versions:
1.2.0,1.3.1
Fixed Versions:

Related Reports
Duplicate:
Duplicate:
Relates:

Sub Tasks

Description
It would be useful if the application being debugged could trigger a JVMPI
heap dump.  It might be the case that a certain point in the program's
execution has a particularly interesting heap topology.  A developer debugging
such an application might find it useful to programmatically trigger a dump
at such a point, by calling a private, VM-specific API (like
sun.debug.jvmpi.Mumble.triggerHeapDump()).

                                    

Comments
EVALUATION

As noted, this is possible in mustang - here's a sample code fragment to demonstrate how an application can create a heap dump of its own heap:

import java.lang.management.ManagementFactory;
import javax.management.ObjectName;
import javax.management.MBeanServer;

:
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName oname = new ObjectName("com.sun.management:type=HotSpotDiagnostic");

Object[] params = { "heap.bin" };
String[] sigs= { "java.lang.String" };

mbs.invoke(oname,  "dumpHeap",  params, sigs);
  

The HotSpotDiagnosticMXBean was added via 6283436 so I'll this RFE as a dup.
                                     
2005-12-20
EVALUATION

This is already possible using the dumpHeap operation on the HotSpotDiagnosticMXBean.
                                     
2005-11-21



Hardware and Software, Engineered to Work Together