Memory Leak in Python 2.5.1?

Suresh Kumar sureshkk at gmail.com
Tue Jun 5 06:21:39 EDT 2007


Hi,

I am currently investigating what seems to be a memory leak in python.
(version 2.5.1). I have made python work with a custom memory sub-allocator
(pool). The idea is to  preallocate a pool of memory during initialization
of my application and ensure that Python doesn't make any system mallocs
(similar to max heap setting in java VM). With this arrangement, python
seems to run out of preallocated memory after few iterations of the
following code:

int main(int argc, char *argv[]){
       int i;
       mem_init(3000000);//Initialize the memory pool with 3M
       for (i=0;i<2000,i++){
              Py_Initialize();
              Sleep(1000);
              Py_Finalize();
       }
}


The above code runs out of memory after 1000 + iterations. To me this looks
like a memory leak, Does anyone out there have any idea whats happening
here?

Regards,
Suresh

-- 
"Everything of value that people get from religion can be had more honestly,
without presuming anything on insufficient evidence. The rest is
self-deception, set to music."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070605/55b5f8b8/attachment.html>


More information about the Python-list mailing list