![]() |
|
more useful options | |
PerlMonks |
Memory consumption of forks on exitby egga (Monk) |
on May 19, 2011 at 10:59 UTC ( #905667=perlquestion: print w/replies, xml ) | Need Help?? |
egga has asked for the wisdom of the Perl Monks concerning the following question: Hi Monks! I have a problem and no idea how to solve it. I already spent some time googling and searching the monastery, but perhaps anyone can point me to the right node or site. We have a script that builds up a large data structure and afterwards forks (we're on linux). The children do only read on that structure, so there is no need to copy it (which is important, because the machines don't have enough memory to handle a copy of the structure for each fork). If we terminate the children using exit(), the structure is being copied for each child. If they get terminated using POSIX::_exit that will not happen. I think that is not nice and really would appreciate any other way to do that. Because I want an END block be called for each child and I don't have a clue, how to get this working. If you wonder about that copy behavior, I prepared a small script, which proves the point (although i guess, most of you know it already). I watched my memory usage while execution and see a pretty high peak after the sleep if I alter the POSIX::_exit to a normal exit. Perhaps you need to adjust the array size for your computer...
Back to
Seekers of Perl Wisdom
|
|