Perl Folks,
I've never really used Perl for processes that run for a very long time.  But, 
I'm moving around and processing data on the scale of millions and millions.  
 
My issue is that I have a memory leak somewhere.
 
I think it's in a statement like this.
 
my $profile=XXX::Profiles::Profile->new(name=>$name, parent=>$self);

where it is important for the child object to know who's it's parent is.  But, 
I guess the garbage collector is not cleaning this up when both the parent and 
child go out of scope.
 
I don't think this is a "circular" reference (I called it a tree; like family 
tree) but it's all I've got as to an inkling of an idea of where my memory leak 
might be.
 
Is this the use case for weaken?  If so, where would you put the weaken 
statement, in the parent or the child.
 
for example in parent 
 
weaken $profile->{"parent"}; #but now the parent has to know about the 
internals of the child
 
in the child
 
sub new {
...
 weaken $self->{"parent"} if (exists($self->{"parent"}) and 
ref($self->{"parent"})); #don't want to auto vivify.
}
 
Am I correct in thinking this is a use case of weaken at all?
 
It also bothers me that Fedora appears to not get all of the memory back after 
the Perl process terminates.  Is that common?
 
Thanks,
Mike
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/

Reply via email to