Skip to content

Commit

Permalink
[BUGFIX] Prevents memory leaks on static object ($my)
Browse files Browse the repository at this point in the history
Release resources once the main object goes out of scope.
  • Loading branch information
mgreter committed Mar 10, 2014
1 parent c77cda1 commit 4f8fd2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
11 changes: 2 additions & 9 deletions lib/pQuery.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ sub PQUERY {
return 'PQUERY'->new(@_);
}

sub reset{
$my = {};
undef $document;
}

#------------------------------------------------------------------------------#
# New ideas / Playing around stuffs
#------------------------------------------------------------------------------#
Expand Down Expand Up @@ -879,6 +874,8 @@ sub _find_elems {
}
}
sub DESTROY { delete $my->{$_[0]}; }
#------------------------------------------------------------------------------#
# THE AMAZING PQUERY
#------------------------------------------------------------------------------#
Expand Down Expand Up @@ -1158,10 +1155,6 @@ This method returns the index number of its argument if the elem is in the
current pQuery object. Otherwise it returns -1.
=head2 reset()
This method releases resources associated with pQuery and prevents memory leaks
=head1 UNDER CONSTRUCTION
This module is still being written. The documented methods all work as
Expand Down
1 change: 0 additions & 1 deletion t/reset.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ no_leaks_ok{
my $i = shift;
my $elem = $_;
});
$pq->reset();
} 'memory leak with traversal';


0 comments on commit 4f8fd2a

Please sign in to comment.