Request java heap dump (core dump) from within application
I need a way to request a heap dump from within the application . Rationale: When I encounter a specific error condition, I'd like to dump heap, so that I can see what is holding on to the memory. But I would like to automate this (For example, when I detect that some specific condition has occurred. Or when a watchdog doesn't gets its pings anymore. When some test fails). Thus I need a way to dump the heap from within the application itself. I can't seem to find it with the MX beans stuff. Although the MX Beans can give very nice stack traces with monitor and "ownable synchronizer" info,