I personally use

check_call('convert ...', shell=True)

to spread out the procedure. This really is run inside apache. I get this exception following a couple of days:

 File "/usr/lib/python2.6/subprocess.py", line 457, in check_call
    retcode = call(*popenargs, **kwargs)

  File "/usr/lib/python2.6/subprocess.py", line 444, in call
    return Popen(*popenargs, **kwargs).wait()

  File "/usr/lib/python2.6/subprocess.py", line 595, in __init__
    errread, errwrite)

  File "/usr/lib/python2.6/subprocess.py", line 1009, in _execute_child
    self.pid = os.fork()

OSError: [Errno 12] Cannot allocate memory

I investigated just a little and this is what I found. Apparently, I'm drained of file descriptors. However, I do not see where they get leaked. Does anybody possess a hint the way i can deal with this?


@SilentGhost: Due to this: http://bramp.net/blog/python-close_fds-issue.