[New-bugs-announce] [issue5092] weird memory usage in multiprocessing module
report at bugs.python.org
Thu Jan 29 01:13:40 CET 2009
New submission from Jerzy <jerzyo at genesilico.pl>:
I am using the multiprocessing mudule and I found a very weird thing.
It seems that that the result of one fragment of the code depends on the
fragment of the code that is after it, which should not happen.
My script looks like this
for i in range(2*1000*1000):
process = multiprocessing.Process(target=f)
And its output is as expected:
but when I uncoment the 'del l' line I get:
line 231, in _bootstrap
line 88, in run
File "bin/momory.py", line 6, in f
UnboundLocalError: local variable 'l' referenced before assignment
How is that? The line that deletes l is after the printing line. How
python interpreter knows that l will be deleted. This is a very anomalus
behaviour and should never happen.
By the way. Is there any way to free some parts of memory in child
process. Suppose I wand to create 100 child processes that do not use
the l list. How can I avoid making 100 copies of l in child processes.
That is my firs post and won't come here very often, so please answer
also to my email (if it is not automaic). I am running python 2.6.1 on
ubuntu 8.04 32bit.
title: weird memory usage in multiprocessing module
type: resource usage
versions: Python 2.6
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce