Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Alias (5735)

  (email not shown publicly)

Journal of Alias (5735)

Wednesday August 29, 2007
02:32 AM

Devel::Leak::Object now 39% more evil!

[ #34257 ]

Mucking around with Devel::Leak::Object at work on Monday, I managed with very little effort to locate an object "leak" (we were loading a bunch of stuff in Apache child init handlers, instead of at startup time in the parent like we should have).

Immediately memory savings across 25 children? 600 meg! Multiplied by 5 boxes in the cluster. At the very least that should delay the need to add a new server to the cluster for a few months.

Inspired by the quick win, I've been trying to hook D:L:Object in deeper to the Apache server, to look for more leaking cases (our web app uses enormous amounts of ram, and despite it legitimately needing a lot for certain tasks, I'm thinking there's probably much more that isn't necesary).

Unfortunately, D:L:Object was originally written in the days when stringifying references to get information about them was still common practice, and as such if I try to load in the global bless/DESTROY hooks early, many many things explode violently due to IO/REF objects and stringification overloads in the 120meg of CPAN and company-specific modules that the server loads.

So with Ivor's permissions, I have taken over Devel::Leak::Object and done a complete rewrite using Scalar::Util instead of ref($object) string parsing, and adding support for things like single-param bless.

I've also covered a few extra edge cases using some evil code stolen from the ugly guts of Class::Autouse.

The new 0.90 release should appear on your CPAN mirror shortly. I encourage anyone interested in leak detection, caches, et al, to throw everything you have at it and see what you can still break.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I am very pleased that Adam is able to take my original concept of a leak tracer for objects and improve on my stringification approach. I'm also pleased that use.perl seems to have given this module recognition and publicity it deserves.

    • Ack! :(

      Indeed, I forgot to thank Ivor specifically for creating this module in the first place. I hadn't ever considered overriding global bless and hooking DESTROY as a viable method, but it's proved an excellent way to do it (although obvious things in Devel:: that do evil tricks like that should never be run on production).