Skip to content

Instantly share code, notes, and snippets.

@fmnoise
Created April 26, 2020 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmnoise/9e289c920c219b32cba823578664c172 to your computer and use it in GitHub Desktop.
Save fmnoise/9e289c920c219b32cba823578664c172 to your computer and use it in GitHub Desktop.
Making heap dump from repl
;; 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