Hi Staffan, Thank you very much for the presentation and the quick response.
Jcmd/jmap : Unfortunately, we ship only the Client JRE with our product. Customer doesn’t have access to jcmd/jmap. That’s why I was looking for an outside solution. Then I came across https://github.com/apangin/jattach – however this is only for linux/bsd. I wanted to use “HotSpot Dynamic Attach Mechanism” to dump the heap on Windows by writing a similar utility for windows. Thanks again, BR, ~A From: Staffan Larsen [mailto:staffan.lar...@oracle.com] Sent: Thursday, March 31, 2016 12:53 AM To: Bacchu, Anjan <anjan.bac...@hpe.com> Cc: serviceability-dev@openjdk.java.net Subject: Re: javaone 2012 presentation on Diagnosing Your Application on the JVM : Question on attach on Windows On 30 mars 2016, at 09:40, Bacchu, Anjan <anjan.bac...@hpe.com<mailto:anjan.bac...@hpe.com>> wrote: Hi Staffan, I just now saw the presentation slides at http://www.slideshare.net/stalar/diagnosing-your-application-on-the-jvm. On Slide 16 of the presentation, you show the details of the “HotSpot Dynamic Attach Mechanism” for Windows. 1) You talk about Remote process injecting code into the JVM using combination of VirtualAllocEx and 2) WriteProcessMemory. Further it goes ahead and creates a Remote thread in the JVM to call above code. Do you have some sample code which does this, to say, dump the heap ? If you want to dump the heap, take a look at “jcmd <pid> GC.heap_dump”: ---------- Generate a HPROF format dump of the Java heap. Impact: High: Depends on Java heap size and content. Request a full GC unless the '-all' option is specified. Permission: java.lang.management.ManagementPermission(monitor) Syntax : GC.heap_dump [options] <filename> Arguments: filename : Name of the dump file (STRING, no default value) Options: (options must be specified using the <key> or <key>=<value> syntax) -all : [optional] Dump all objects, including unreachable objects (BOOLEAN, false) ---------- You can also use “jmap -dump <pid>. I used to develop windows application long ago and just from the slide #16 andhttp://openjdk.java.net/groups/hotspot/docs/Serviceability.html#battach, I’m unable to proceed further. The source code is in the VirtualMachineImpl.c file for windows: http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/1565a0efe6f0/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c All help will be useful. Thank you very much, BR, ~A