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 ]

pierre (4339)


Pierre is an engineer in mechanics converted to software development.

Journal of pierre (4339)

Saturday April 24, 2004
11:38 AM

YAPC::NA talks

YAPC::NA program is promising, I can't wait!

I will give some feedback from an employer point of view about Perl candidates. Things like "plus points" and "minus points" of Perl developers, distinctive traits of Perl Developers etc. I have two hats: one as a Perl developer and another one as a Manager. I will take advantage of this to compile some (hopefully) useful comments. They may not all be positive, but I hope this will lead to an interesting debate :-)

I am collecting ideas at the moment to enrich the talk, so if you have subjects you would like a recruiter to talk about, I am interested.
Saturday November 08, 2003
11:56 AM

Circular references and memory leaks are dead!

At work, we have a big application on production under mod_perl and which is leaking. And when I mean leaking, I mean it is a massive flood.
Something had to be done about it.

I tried several modules available. Devel::Leak and Devel::LeakTrace. They sound interesting, but I already knew there was a memory leak. And Devel::LeakTrace depends on glib and doesn't install on my box.

Any way, I figured out what I really needed. I want to scan variables for circular references and have a report of where they are. If I can obtain a reference to a circular refence somewhere in perl, then I can dump it and I can figure out what it is. So I released to CPAN Data::Structure::Util which does just that. You give it a data structure and here you go, it tells if there is a circular reference and where it is. I hacked a script to scan through all the global variables and I could find in 5mn exactly where was our memory leak! We fixed it, then I redid the same process and sure enough we found another circular reference generating a memory leak. Then the 3rd time, I found a circular reference in Template Toolkit. But this one is harmless, since TT does break the circular reference when the object is not needed. So it doesn't generate memory leak.
We have no more memory leak in our code (or at least nothing significant)!

I have the feeling we are about to fix many memory leak in CPAN modules in the near future :-)