Memory leak when importing?

Harald Kirsch kirschh at lionbioscience.com
Mon Mar 4 10:54:58 EST 2002


I have a strange effect with python 2.0 and 2.1. A C-module of mine
calls via

  PyObject_CallObject(callable, args);

a function defined in a script. This function again does an 

  import re

When the function is called over and over again, the python-process
allocates more and more memory. When I comment out just the
import-statement, the leaky behaviour is gone.

I am able to comment out the import-statement because I trimmed the
function down for debugging to not use it any more.

For comparison, I tried 

  def doit():
    import re

but this does not leak. Consequently my C-module might be the reason.

Any ideas? Rough guesses?
  Harald Kirsch

P.S.: I know that importing within a function is not the best thing to
do. 

-- 
----------------+------------------------------------------------------
Harald Kirsch   | kirschh at lionbioscience.com | "How old is the epsilon?"
LION bioscience | +49 6221 4038 172          |        -- Paul Erdös
       *** Please do not send me copies of your posts. ***



More information about the Python-list mailing list