Skip to content

Commit

Permalink
Fix for memory leak in GH #86
Browse files Browse the repository at this point in the history
  • Loading branch information
toddr committed Mar 27, 2018
1 parent 92df006 commit 8a99cb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/IPC/Run.pm
Expand Up @@ -1135,6 +1135,12 @@ sub _debug_fd {
return fileno STDERR unless defined $cur_self->{DEBUG_FD};

return $cur_self->{DEBUG_FD};

for my $kid ( @{ $self->{KIDS} } ) {
for my $op ( @{ $kid->{OPS} } ) {
@{ $op->{FILTERS} } = ();
}
}
}

sub DESTROY {
Expand Down Expand Up @@ -2642,7 +2648,7 @@ sub _do_kid_and_exit {
_close $self->{SYNC_WRITER_FD};
_debug 'calling fork()ed CODE ref' if _debugging;
POSIX::close $self->{DEBUG_FD} if defined $self->{DEBUG_FD};
## TODO: Overload CORE::GLOBAL::exit...
## TODO: Overload CORE::GLOBAL::_exit...
$kid->{VAL}->();

## There are bugs in perl closures up to and including 5.6.1
Expand Down
1 change: 1 addition & 0 deletions lib/IPC/Run/IO.pm
Expand Up @@ -344,6 +344,7 @@ sub open_pipe {
sub _cleanup { ## Called from Run.pm's _cleanup
my $self = shift;
undef $self->{FAKE_PIPE};
undef $self->{FILTERS};
}

=item close
Expand Down

0 comments on commit 8a99cb8

Please sign in to comment.