Speeding up Python's exit
jeanpierreda at gmail.com
Thu Feb 28 18:33:02 CET 2013
On Thu, Feb 28, 2013 at 12:31 PM, Devin Jeanpierre
<jeanpierreda at gmail.com> wrote:
> On Thu, Feb 28, 2013 at 12:06 PM, Chris Angelico <rosuav at gmail.com> wrote:
>> Is it any different if you create a deliberate reference loop and then
>> stuff it into some module somewhere? That would force it to be kept
>> until interpreter shutdown, and then a cyclic garbage collection after
>> that, which quite probably would be never run. A stupid trick,
>> perhaps, but it might work; I tested it with a dummy class with a
>> __del__ method and it wasn't called. Putting it into some other module
>> may not be necessary, but I don't know what happens with the
>> interactive interpreter and what gets freed up when.
> __del__ is never called for cyclic references.
Sorry, I posted too early. Not only is __del__ never called, but
__del__ is the reason the cycles aren't collected. I don't know if
your trick will work without __del__.
More information about the Python-list