Skip to content

Instantly share code, notes, and snippets.

@thepug
Created October 18, 2010 16:56
Show Gist options
  • Save thepug/632569 to your computer and use it in GitHub Desktop.
Save thepug/632569 to your computer and use it in GitHub Desktop.
show the erlang proc with highest heap allocation
filename = File.expand_path(File.join(File.dirname(__FILE__), "erl_crash.dump"))
next_line = false
heapallocs = []
counters = []
File.open(filename, "r") do |crashfile|
while (line = crashfile.gets)
if (line =~ /^Stack\+heap:\s(\d)/)
heapallocs.push(Integer(line.split(':')[1]))
end
if (line =~ /^Program\scounter:/)
counters.push(line)
end
end
end
p counters.length
p heapallocs.length
Hash[*counters.zip(heapallocs).flatten].sort{|a,b| b[1]<=>a[1]}.each { |elem|
puts "#{elem[1]}, #{elem[0]}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment