script uses up all memory

Marko Rauhamaa marko at
Fri Mar 7 00:12:31 CET 2014

Chris Angelico <rosuav at>:

> I think this thread is proof that they are to be avoided. The GC
> wasn't doing its job unless explicitly called on. The true solution is
> to break the refloop; the quick fix is to call gc.collect(). I stand
> by the recommendation to put an explanatory comment against the
> collect call.

What I'm saying is that under most circumstances you shouldn't care if
the memory consumption goes up and down. The true solution is to not do
anything about temporary memory consumption. Also, you shouldn't worry
about breaking circular references. That is also often almost impossible
to accomplish as so much modern code builds on closures, which generate
all kinds of circular references under the hood—for your benefit, or


More information about the Python-list mailing list