Skip to content

Instantly share code, notes, and snippets.

View temojin's full-sized avatar

Hung Q Tran temojin

View GitHub Profile
@temojin
temojin / gist:264925
Created December 28, 2009 20:41 — forked from jruby/gist:259743
~/projects/jruby ➔ jirb
irb(main):001:0> require 'java'
=> true
irb(main):002:0> import com.sun.tools.attach.VirtualMachine
=> Java::ComSunToolsAttach::VirtualMachine
irb(main):003:0> vm = VirtualMachine.attach($$.to_s)
=> sun.tools.attach.MacosxAttachProvider@47875da7: 3294
irb(main):004:0> histo = vm.heap_histo([].to_java).to_io
=> #<IO:0x32b95f72>
irb(main):005:0> histo.lines.first(25).each {|line| puts line}; nil