Stefan Behnel wrote: > Hmm, true. When each object references its type, which in turn references > the module instance, which in turn references the type, that means that > *all* objects created in a module will end up requiring the GC due to > reference cycles. > > I guess we need to raise these issues on python-dev. They'll be happy to > dig into the real-life issues anyway. I'm pretty sure we'd be the first to > actually use the new module features. > >> In any case, the only way to write safe code is to avoid the usage of >> module-level globals in __del__() and __dealloc__() methods... > > Which is a rare thing anyway. Most of the time, you'd just call some kind > of free() function and be done.
If it turns out these reference cycles will be a problem, I think we could always change Cython to *not* use initialized constants in __del__ and __dealloc__? (i.e. construct them on need; meaning a small performance penalty). The global constants system could need a cleanup anyway/move to code generation time (low priority in itself though). If that was done, change the behaviour of constants in __del__ etc. would be rather easy. http://trac.cython.org/cython_trac/ticket/144 -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
