in reply to Memory consumption of forks on exit

That happens because when the interpreter shuts down, it deallocates all the Perl structures one by one, effectively writing to the memory where they are stored.

Under Unix/Linux, that means that as the memory is write-accessed, the kernel has to perform a copy-on-write of the underlaying pages.

As a workaround, try calling _exit or exec "/bin/true"; at the end of the END blocks.

Replies are listed 'Best First'.
Re^2: Memory consumption of forks on exit
by egga (Monk) on May 19, 2011 at 11:22 UTC

    Ok, thats a good explanation. But I still want to execute the end blocks of the children, which doesn't happen if I try your workarounds.

      Then its simple, don't use end blocks, instead use
      used_to_be_an_end_block(); dance(); POSIX::_exit(0);

        Yeah, right! Didn't think of that. Could be a solution, but it's still not really pretty, because that exits are scattered all over the place (not my fault).

        /me dances around a bit as it was suggested