I just quit an interactive session using Python 2.7 on Linux. It took in 
excess of twelve minutes to exit, with the load average going well past 9 
for much of that time.

I think the reason it took so long was that Python was garbage-collecting 
a giant dict with 10 million entries, each one containing a list of the 
form [1, [2, 3], 4]. But still, that's terribly slow -- ironically, it 
took longer to dispose of the dict (12+ minutes) than it took to create 
it in the first place (approx 3 minutes, with a maximum load of 4). 

Can anyone explain why this was so painfully slow, and what (if anything) 
I can do to avoid it in the future?

I know there is a function os._exit which effectively kills the Python 
interpreter dead immediately, without doing any cleanup. What are the 
consequences of doing this? I assume that the memory used by the Python 
process will be reclaimed by the operating system, but other resources 
such as opened files may not be.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to