<br><div class="gmail_quote">On Sun, Nov 14, 2010 at 11:08 AM, Artur Siekielski <span dir="ltr"><<a href="mailto:artur.siekielski@gmail.com">artur.siekielski@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi.<br>
I'm using CPython 2.7 and Linux. In order to make parallel<br>
computations on a large list of objects I want to use multiple<br>
processes (by using multiprocessing module). In the first step I fill<br>
the list with objects and then I fork() my worker processes that do<br>
the job.<br></blockquote><div> </div></div>You could try <a href="http://docs.python.org/library/multiprocessing.html#multiprocessing.Array">http://docs.python.org/library/multiprocessing.html#multiprocessing.Array</a> to put the data in shared memory.<br>
<br>Copy on write is great, but not a panacea, and not optimal in any sense of the word I'm accustomed to.  Like you said it depends on page boundaries, and also it can kind of fall apart if a shared library wasn't built as position independent code due to all the address fixups.  And it's mostly code that gets shared - data tends to diverge.<br>
<br>Supposedly at one time Sun was able to drastically reduce the memory requirements of Solaris by grouping related variables (things that were likely to be needed at the same time) into the same pages of memory.<br><br>
Is it possible you're just seeing a heap grow that isn't getting garbage collected as often as you expect?  Normal computation in Python creates objects without free'ing them all that often.<br><br>HTH<br><br>
<br>