Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Re: Mod_perl, Memory Leaks and WeakRef

by djantzen (Priest)
on Dec 25, 2003 at 01:33 UTC ( #316947=note: print w/replies, xml ) Need Help??

in reply to Re: Mod_perl, Memory Leaks and WeakRef
in thread Mod_perl, Memory Leaks and WeakRef

Well you're right about DESTROY; after rereading perlobj I see it doesn't actually cause any reference destruction, but just gives the programmer a last chance to do some custom cleanup. So that's out. As for Graph::Directed, it utilizes an adjacency matrix which is why it doesn't introduce the reference problems I'm encountering. I chose to write my own graph class utilizing an adjacency list though since the graph itself must be persisted in a database, and building a table with an 'origin' => 'destination' mapping seemed more natural than trying to store a matrix or translate between the two implementations when moving between disk and memory.

Your last suggestion may well work, although I'll have to make some changes to the way I treat my graph object references. Actually perlobj suggests basically the same thing: "the best solution is to create a non-recursive container class that holds a pointer to the self-referential data structure. Define a DESTROY method for the containing object's class that manually breaks the circularities in the self-referential structure."

thanks for the input davido.

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://316947]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2020-05-30 06:36 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (171 votes). Check out past polls.