It seems that certain functions implement they're memory management (this one being one of them) and the rest rely on the programmer to explicitly free memory.
I guess I will go with a need_free attribute as well. Thanks for all the help! Chris On Tue, May 19, 2009 at 11:27 PM, Lisandro Dalcin <[email protected]> wrote: > Such a flag would work... For example, IIUC ctypes does this (I'm > remembering a 'needs_free' attribute or something like that on some > ctypes instances...) > > Just in case, I'll ask... Any chance the library you are using has > some sort of reference count mechanism? If it do, you sould rely on > that to implement Image.__dealloc__() ... If not, how do you track > ownership of your C handles in a pure-C code ?? > > > On Tue, May 19, 2009 at 11:42 PM, Chris Colbert <[email protected]> > wrote: > > > > > >> Any chance that cvQueryFrame() returns an image that you should not > >> free?? > >> > > that's exactly it (i feel really dumb for having missed it) > > > >> > >> the first img is likely garbage-collected. Perhaps your > >> Image.__dealloc__ is not doing the right thing in this case? > > > > > > would you suggest setting a private C-attribute (flag) that indicates the > > image was created by this (or any other) function where i'm no supposed > to > > explicity release it, then check that flag in __dealloc__ and proceed > > accordingly? > > > > This would be my knee jerk reaction around the problem, but maybe you > have a > > more elegant solution. > > > > Chris > > > > _______________________________________________ > > Cython-dev mailing list > > [email protected] > > 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 > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev >
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
