I am creating a lot of child processes using Parallel::ForkManager and then killing them using kill 'KILL', $_ for $pm->running_procs
, but there is a big memory leak in doing this:
Note that using kill('KILL', ...) on a pseudo-process() may typically cause memory leaks, because the thread that implements the pseudo-process does not get a chance to clean up its resources.
Source: http://perldoc.perl.org/perlfork.html#Behavior-of-other-Perl-features-in-forked-pseudo-processes
How can I kill the child processes and not cause the big memory leak?