in reply to Re^2: understanding devel::leak
in thread understanding devel::leak
I've just added an undef ....; to the end of all relevent functions to correspond with all the my ......;
Whether undef-ing works, depends on what exactly you undef. In the trivial example above, undef $h at the end of the loop wouldn't help (as that's implicitly happening anyway), while undef %$h, undef $h->{myself} or delete $h->{myself} would help. Point is that you have to break the circle before the data structure becomes unreachable...
In real life, self-referencing circles are often not immediately evident, as they may come into being indirectly through several data structures, e.g. A references B, which references C, which ... references A — or some such. Your ref counts > 1 might hint at such a situation, unless you have another good explanation for them :)
Sometimes (if all else fails), it helps to step by step disable parts of the program, until the problem goes away. In this case, look more closely into whatever that last part was, etc. — Without seeing any actual code, it's hard to come up more specific tips.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: understanding devel::leak
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 |