http://qs321.pair.com?node_id=319944


in reply to Re: Depth First Search through Digraph Results in Memory Leak
in thread Depth First Search through Digraph Results in Memory Leak

Well I'll be damned, that fixes it. I've changed $nodes = '' to undef $nodes with the same results. So for some reason perl needs to be told to destroy the array when it should take a cue from the lexical going out of scope. I'll prepare a bug report after I stop sighing in relief. Thank you Hofmator!


"The dead do not recognize context" -- Kai, Lexx

Replies are listed 'Best First'.
Re: Re: Re: Depth First Search through Digraph Results in Memory Leak
by diotalevi (Canon) on Jan 08, 2004 at 22:49 UTC

    Change those print calls to warn(). I'm guessing that those arrays are kept around because the closures were kept around and that both were eventually cleaned up during global destruction. You are always free to clear a variable with prejudice - use undef as a function. undef $nodes might give you some different results. (you already did that. Whoops).

    That may still be a bug though but whether it is in the reference counting of $nodes' array or $sub's clusure I don't know. But then it isn't clear to me that it is a bug.