Re: Manually prompting garbage collection

2008-07-16 Thread Kyle Lanclos
Fredrik Lundh wrote: > Yeah, but what do you expect that garbage collection pass to result in? Basically, I want to toss the objects before I close the service that they depend on. > PyGC_Collect() does exactly that, so if that doesn't solve your problem, > the only way to fix is this is to go b

Re: Manually prompting garbage collection

2008-07-16 Thread Fredrik Lundh
Fredrik Lundh wrote: > Do these objects have direct references to a resource that you're > explicitly destroying from your C code? and yes, if this is the problem, the correct solution is to create an separate object type that's designed to manages the resource and act as a proxy against it, a

Re: Manually prompting garbage collection

2008-07-16 Thread Fredrik Lundh
Kyle Lanclos wrote: The DECREF decrements the reference count, but does not immediately prompt garbage collection when the reference count drops to zero; that garbage collection does not appear to occur until I return from the particular C function I am in the middle of executing. Yeah, but wh

Re: Manually prompting garbage collection

2008-07-16 Thread Kyle Lanclos
Fredrik Lundh wrote: > what magic do you expect the "manual garbage collection" to do here that > the DECREF doesn't already do? The DECREF decrements the reference count, but does not immediately prompt garbage collection when the reference count drops to zero; that garbage collection does not a

Re: Manually prompting garbage collection

2008-07-16 Thread Fredrik Lundh
Kyle Lanclos wrote: I want to modify the above sequence to manually prompt Python's garbage collection routine(s) to take over (performance is not an issue here), similar to the following: Py_XDECREF (some_callback); PyCollect_Garbage (); closeService (some_service); return; Is that possible?

Manually prompting garbage collection

2008-07-16 Thread Kyle Lanclos
I've done a lot of web searching, a fair bit of C-source reading, and quite a lot of miscellaneous head scratching, and I find that I am not necessarily closer to an ideal solution. I have a Python/C interface layer that essentially does the following: Py_XDECREF (some_callback); closeService (so