At the end of my program, where nothing really needs to happen, the CPython 3.2 interpreter spends almost 2 minutes doing garbage collection. It is a known issue.
Luckily, in my case, I don't need to do any garbage collection until the end of the program. Therefore, I just need to find a way to exit the program when it's done, without giving gc.collect()
a chance to run.
Pressing 'CTRL+C' on Windows seems to do it. I suppose I could also find the process id of the python interpreter, and kill it using an OS call.
Is there a way to achieve the same effect using pure Python (perhaps an exception or a standard library call), hopefully platform-independent?