Created
April 26, 2020 13:05
-
-
Save fmnoise/9e289c920c219b32cba823578664c172 to your computer and use it in GitHub Desktop.
Making heap dump from repl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; https://matthewdowney.github.io/forcing-jvm-heap-dump-programmatically-clojure.html | |
(import 'java.lang.management.ManagementFactory) | |
(import 'com.sun.management.HotSpotDiagnosticMXBean) | |
(let [server (ManagementFactory/getPlatformMBeanServer) | |
bean-name "com.sun.management:type=HotSpotDiagnostic" | |
bean (ManagementFactory/newPlatformMXBeanProxy server bean-name HotSpotDiagnosticMXBean) | |
live-objects-only? false] | |
(.dumpHeap bean "dump.hprof" live-objects-only?)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment