From: Ethan Glasser-C. <gl...@cs...> - 2007-05-29 23:13:33
|
Chris Bainbridge wrote: > The _geom_c2py_lut is a dictionary that serves as a lookup table to > convert the geom pointer received from ODE into the appropriate Python > geom object (which has to be done during collisions). > So when a geom is created it adds itself to the dictionary and indeed, > it is never removed from there. > The geom cannot remove itself in __dealloc__() because as long as > there's a reference in the dictionary it is not destroyed and > __dealloc__() is never called. The solution would be weak references but > at the time I wrote the stuff Pyrex didn't support this. I contacted the > author, but I believe the current version of Pyrex still doesn't support > it (I haven't checked explicitly but at least I never noticed anything > in the changelogs). Pyrex seems to have weakref support: http://www.sagemath.org:9002/sage_trac/ticket/165 Here's a simple patch that seems to run Martin Vopatek's test case without running out of memory. I have no idea if it does anything else, though! Please test carefully. Ethan |