Subject: | Memory Leak in module XBase |
#Example code
use strict;
use XBase;
my ($pass,$obj);
while(1){
$obj=XBase->new("abc.dbf") or die XBase->errstr;
$obj->close();
sleep 1;
print ++$pass." Ok!\n";
}
exit;
XBase version 1.02
ActivePerl
This is perl 5, version 14, subversion 1 (v5.14.1) built for MSWin32-
x86-multi-thread
Similar result for other versions ActivePerl - 5.8.9, 5.12.4
OS - WindowsXP SP3 Professional
Possibly problem that object XBase contains references to arrays and
hashes.
I offer the changed method close for class XBase
# Close the file (and memo)
sub close {
my $self = shift;
if (defined $self->{'memo'}) {
$self->{'memo'}->close(); delete $self->{'memo'};
}
$self->SUPER::close();
#The next line is added in an existing method for removal of references
from object
for(keys %$self){ delete $self->{$_}; }
}