Sarmun
Sarmun

Reputation: 2408

Creating memory snapshot from inside the code (Java)

Is there a possibility, that from inside your program, by calling some java library, make java create memory snapshot of that program? (default .hprof file)

Upvotes: 4

Views: 2158

Answers (2)

Andrzej Doyle
Andrzej Doyle

Reputation: 103837

You can do it via JMX - which means that you have to go out to come back in, so to speak. Details on how to do it via code are available here.

Upvotes: 2

Jeff Foster
Jeff Foster

Reputation: 44706

You can create a heap dump in your application using the example here.

Upvotes: 5

Related Questions