[Cython] Probably Memory Leak

ben.strulo at bt.com ben.strulo at bt.com
Fri Mar 8 10:25:10 CET 2013


Hi there,

I think I may have found a memory leak in cpython.array.  Or I may have screwed up:

I have a test.pyx containing:

#----------------------------

from cpython.array cimport array,clone

cdef class Test(object):
    cdef int[:] myarr

    def __init__(self):
        cdef array templatei = array("i")
        self.myarr = clone(templatei,10000,True)

#----------------------------

Then a test harness which is just:

#----------------------------

import test

i = 0
while True:
    print i
    i += 1
    s = test.Test()

#----------------------------

And this fills memory until I get a MemoryError exception.  I'm using a fresh copy of Cython from Git (unless I messed that up :)) on Windows, compiling with MSVC 9.  Not sure what diagnostics might help but it's a pretty simple test case.

I haven't found a bug in the Cython source but this doesn't seem right.

Hope this is of interest

Ben Strulo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20130308/a3c6b468/attachment.html>


More information about the cython-devel mailing list