Is it possible that inside your program, by calling some java library, make java to create a snapshot of the memory of this program? (default .hprof file)
You can dump heaps in your application using the example here .
You can do this through JMX - that means you have to go to return, so to speak. Details on how to do this using code are available here .