in reply to understanding devel::leak
Is there anything missing that compiling with -DDEBUGGING would add?
Yes, if your perl had been built with -DDEBUGGING, Devel::Leak would call its (then available) routine sv_dump() on the things in question, which would produce output similar to what you'd get with the module Devel::Peek. How much that helps, though, will depend on the particular situation...
Anyhow, most problems with memory leaks in Perl code are related to circular references. Consider the following
for (1..1000000) { my $h = {}; $h->{myself} = $h; }
This harmlessly looking piece of code consumes about 130MB (on my machine). Reason is that the anonymous hashes (referenced by $h) are not being freed, because they're holding a reference to themselves, so their reference count doesn't drop to zero when the $h goes out of scope...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: understanding devel::leak
by nonnonymousnonk (Novice) on Oct 04, 2007 at 11:30 UTC | |
by almut (Canon) on Oct 04, 2007 at 13:23 UTC | |
by jczeus (Monk) on Oct 05, 2007 at 07:18 UTC | |
by almut (Canon) on Oct 05, 2007 at 12:30 UTC | |
by jczeus (Monk) on Oct 16, 2007 at 09:42 UTC |