incubator-kato-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Monteith <stuk...@stoo.me.uk>
Subject hprof generation
Date Wed, 20 May 2009 10:51:19 GMT
Hi,
    I've been working on the hprof implementation of the Kato API, and 
one thing I'd like to do is to be able to generate a complete hprof file 
programmatically. By complete, I mean threads as well as the heap.

So far I've found that with HotSpot we can generate hprof files with the 
following methods:
    -XX:+HeapDumpOnOutOfMemoryError - so generate an hprof file with 
just the heapdump

CTRL+Break - to initiate the agent to generate a complete dump.

And I've found that JMX can be used to generate an hprof file 
programmatically with only the heap, like so:

    MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();  
    
mbeanServer.invoke(ObjectName.getInstance("com.sun.management:type=HotSpotDiagnostic"),
                "dumpHeap",
                new Object[] {"java.hprof",false},
                new String[] {"java.lang.String","boolean"});
      
Unfortunately, the API would normally be even less complete with hprof 
because of this problem. I presume that this is a fundamental limitation 
of how the JVM operates, but I thought I'd mention it in case someone 
knew any tricks.


Thanks,
    Stuart

Mime
View raw message