bleakhouse 4

BleakHouse 4 came to life this weekend.

new implementation

BleakHouse now tracks the spawn points of every object on the heap, somewhat like Valgrind and somewhat like Dike.

This means there is no framing necessary, and the analysis task runs in seconds instead of hours. On the other hand, the pure-C instrumentation means it’s fast enough to run in production, won’t introduce new leaks in your app, and can track T_NODE and other Ruby internals.

sample

After exactly 2000 requests:

$ bleak /tmp/bleak.13795.0.dump
1334329 total objects
Final heap size 1334329 filled, 1132647 free
Displaying top 100 most common line/class pairs
408149 __null__:__null__:__node__
273858 (eval):3:String
135304 __null__:__null__:String
29998 /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:122:String
14000 /rails/activesupport/lib/active_support/core_ext/hash/keys.rb:8:String
11825 /rails/actionpack/lib/action_controller/base.rb:1215:String
7022 /opt/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:557:Array
5995 /rails/actionpack/lib/action_controller/session/cookie_store.rb:145:String
4524 /opt/local/lib/ruby/gems/1.8/specifications/gettext-1.90.0.gemspec:14:String
4000 /opt/local/lib/ruby/1.8/cgi/session.rb:299:Array
4000 /rails/actionpack/lib/action_controller/response.rb:10:Array
...

Somebody’s got an eval leak, for sure. And those session.rb counts are pretty suspicious.

The BleakHouse docs are here. The codebase is very solid and I look forward to adding some neat things in 4.1 and 4.2.

credit where it’s due

Part of the development of BleakHouse 4 was sponsored by a Rails company you have definitely heard of.

11 responses

  1. Yep! I did exactly what I said I would do in my comment on your blog.

    I took a neat shortcut for simplifying the analysis step, though. Instead of rewriting it in something fancy like OCaml, I was smarter about the dump format, and rewrote it in…

    leaks = `sort #{file} | uniq -c | sort -nr | head -#{lines}"
    puts leaks
    

    …Unix pipes.

  2. Oh, man, this is the coolest. Bleakhouse is fast becoming a must-have.

    (“His blog is dirty, splats of paint all over.” my brother-in-law points to the screen.)

  3. @evan,

    Amazing. Those classical unix tools are so cool! But maybe Bleakhouse can be used to analyze the original “bleak” script on where the memory is leaking. :p

  4. The versions got renumbered a while back; sorry. Those initial posts are now incorrect. You could get the old version out of the SVN repository if you really want it, but it sucks compared to the (current) version 4.

  5. Thanks Evan,

    I’ve used version 4 and it was really helpful to locate a cache which was chocking a lot of memory (it was a bug not a leak!).

    However, running in production mode, I find that those nasty

    453522 __null__:__null__:__node__

    57391 __null__:__null__:String

    go up and up, until the heap asks for more memory and so on…

    I’ve searched around trying to find HOWTO deal with these and I could not find anything useful. If I recall correctly in some place you say that these __null__:__null__:__node__ may or may not be leaks. Can you expand a bit further? Do you have some examples?

    Thanks again for you awesome tool,

    Martin

Follow

Get every new post delivered to your Inbox.

Join 535 other followers