[Cython] cython leaks references to Py_None for cdef'ed globals

Lisandro Dalcin dalcinl at gmail.com
Wed Oct 1 21:47:42 CEST 2008


The particular case being discussed, this leak occurs only one time,
at extension module import time.

Anyway, Michael, I'm on your side. In the past, refleaks in numpy made
it very hard for my to make sure in my unittesting that I was not
generating leaks on my code.

So, Dag, I think we should try hard to fix this. My patch fix the
problem, but it's a bit unsafe.  I'm so pedantic (because of bad
experiences in the past) about ref leaks that I always run Cython with
'--cleanup 9' flag. And I always run my full testsuite inside a loop
with debug python builds just to make sure I'm never leaking.


On Wed, Oct 1, 2008 at 4:34 PM, Michael Abshoff
<michael.abshoff at googlemail.com> wrote:
> Dag Sverre Seljebotn wrote:
>
> Hi,
>
>> I say let them leak? The only real risk (that I can see at least) is overflowing the refcount,
>  > and if I understand and remember an informal chat correctly even that
> is eliminated in newer
>  > Python versions where Py_None and friends have special deallocation
> which never deallocate...
>
> I have had the pleasure to debug refcount reference overflows and let me
> say it is not something I would like to repeat since it happened only on
> 32 bit test systems (the count would also wraps on a 64 bit box, but
> that would take a while longer). So I would highly suggest to fix any
> reference count leak since you never want code to crash for stupid
> reasons like this.
>
>> Dag Sverre Seljebotn
>
> <SNIP>
>
> Cheers,
>
> Michael
> _______________________________________________
> Cython-dev mailing list
> Cython-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594


More information about the Cython-dev mailing list