Cage opened this issue on Dec 20, 2006 · 1232 posts
Spanki posted Mon, 17 March 2008 at 3:42 PM
Quote - Right, the built-in garbage collection will handle things... my only reason for wanting to do it explicately is to include the time it takes to do it in the timings (since the new code doesn't have to delete some tables that never got created).
...just to further expand on this (FYI and/or future-reference), keep in mind that due to the nature of the structure of Python ("every item is an object") and also because of it being an interpreted language, some relatively-trivial/harmless-looking things can actually take many cycles to accomplish. Ultimately, each element of data is managed by some piece of compiled C code (like this extension).
So, the code that handles a 'list' object knows how to deal with the list of objects, but doesn't really know (or care) what those objects are. - some other module has to handle them. This means that internally, when the list-handler goes to delete the list (assuming all reference counts or zero), it iterates over the list, calling the delete function of each object's handler.
So, if this is a list of 100,000
The above may not be exactly how thnigs happen (many steps left out), but is just to give some idea of how things are happening 'behind the scenes', which can help explain why deleting a list of objects may potentially take a not-insignificant amount of time :).
Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.