@binkle@hazlin Such is life in the carnival of horrors that is python. Im not going to get into the details but roughly speaking theres reference counting being done to inform the automatic garbage collection, but when that isn't suitable (think reference cycles, the collector not being called soon enough when left to its own devices, etc.), you could, for example, do some simple manual garbage collection by calling the python's garbage collector manually (hence manual garbage collection)
import gc
gc.collect()
# or disable it entirely with
gc.disable()
@hazlin@binkle I'll be honest, I'm getting out of my depth but I would assume there is a deallocation when the reference count of an object hits 0 it would be deallocated (assuming no cyclical references) but this is python, so for all I know the deallocations of objects with 0 reference counts might be queued up and done at certain moments. The gc.collect call is more to try and force collection of objects that have cyclical references that may no longer be valid references (look up generational thresholds or variations of that alongside python to find more info on that)
Add comment