Memory Leak in Python 2.5.1?

Suresh Kumar sureshkk at
Tue Jun 5 12:21:39 CEST 2007


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++){

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


"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: <>

More information about the Python-list mailing list