multiprocessing / forking memory usage

Randall Smith randall at tnr.cc
Tue May 26 19:52:22 CEST 2009


I'm trying to get a grasp on how memory usage is affected when forking 
as the multiprocessing module does.  I've got a program with a parent 
process using wx and other memory intensive modules. It spawns child 
processes (by forking) that should be very lean (no wx required, etc). 
Based on inspection using "ps v" and psutil, the memory usage (rss) is 
much higher than I would expect for the subprocess.

My understanding is that COW is used when forking (on Linux).  So maybe 
"ps v pid" is reflecting that.  If that's the case, is there a way to 
better determine the child's memory usage?  If it's not the case and I'm 
using modules I don't need, how can I reduce the memory usage to what 
the child actually uses instead of including everything the parent is using?

Randall




More information about the Python-list mailing list