Hi,

Robert Bradshaw wrote:
> That is what the cleanup functions do--they try and release the  
> memory in use by the module. The problem is that it isn't easy to  
> tell when a module is still in use (as far as I can tell). It sounds  
> like things have improved with Py3's unloading of modules.

This would be a Py3-only feature. The cleanup code for Py2 would still be
optional.


> A concrete example might help explain things. Say I have a Cython class
> 
> class A:
>      def __del__(self):
>          print 1
> 
> Now when this is compiled, a python int 1 will be created and stored  
> in the module dictionary. If the module defining A is cleaned up  
> before every instance of A is deallocated, then the cached Python 1  
> will be collected and then at some later point A.__del__ could be  
> called, which may result in a segfault.

Ok, but all this means is that the class needs to hold a reference to the
module instance that created it, right?

Stefan

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to