Other than cyclic references (which I don't think could exist in my code), do you know what could cause this to happen?
Well, circular references do not have to be direct. There are lots of subtle ways for creating them. That makes finding them very complex at times.
I don't know about any other reason for perl to keep unused objects around.
| [reply] [Watch: Dir/Any] |
There is a second way for objects not getting released that is not really a cyclic reference: If you have a subroutine that closes over a variable, the value of that variable will not get released. This is especially nasty if you're dealing with lots of callbacks (like in AnyEvent) and don't keep track of which callback closes over which variable.
| [reply] [Watch: Dir/Any] |
Strictly speaking this is not a "leak". The variables are still accessible from the code. They will get released when the subroutine goes out of scope. Of course, if one of subroutines references variable that keeps reference to that subroutine, then neither code, nor the variable will be released, but this is circular reference again :)
| [reply] [Watch: Dir/Any] |
Thanks for your reply.
> If you have a subroutine that closes over a variable, the value of that variable will not get released
What do you mean by "subroutine that closes over a variable"?
| [reply] [Watch: Dir/Any] |