in reply to Memory Leak with XBase?
In our experience OO perl, running persistently 'leaks' ie you observe a consistent growth in memory usage over time despite the fact that there is not more internal data being stored by the widget. Interesting observations include when you 'de OOify' things the leaks tend to become much smaller or dissapear entirely, and calling it a leak is not entirely correct because if you push the system into swap these 'leaky' processes suddenly shrink to a small fraction of there size - unload the system so there is no swap and they stay small but slowly grow over time.
Sometimes undef stuff helps. Rewriting it into a more functional style will probably work as well if it really matters. It will probably make no difference but in the close code you could make an undef change (XBase::Base::close())
sub close { my $self = shift; $self->NullError(); if (not defined $self->{'fh'}) { $self->Error("Can't close file that is not opened\n"); return 0; } $self->{'fh'}->close(); # remove what should be the last ref to the IO::File # object dropped into self on the open undef $self->{'fh'}; # original code called delete like this, may as well stay delete $self->{'fh'}; 1; }
cheers
tachyon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Memory Leak with XBase?
by Anonymous Monk on Mar 18, 2004 at 03:31 UTC | |
by tachyon (Chancellor) on Mar 18, 2004 at 12:20 UTC | |
|
Re: Re: Memory Leak with XBase?
by tigervamp (Friar) on Mar 18, 2004 at 02:45 UTC |