script uses up all memory

Chris Angelico rosuav at gmail.com
Thu Mar 6 17:43:36 EST 2014


On Fri, Mar 7, 2014 at 9:34 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> Not all problems need to be solved perfectly :) But at very least, I
>> would put a comment against your collect() call explaining what
>> happens: that self.tools is involved in a refloop. Most Python code
>> shouldn't have to call gc.collect(), so it's worth explaining why you
>> are here.
>
> Refloops also are nothing to be avoided. Let GC do its job and forget
> about it.

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. [1]

ChrisA

[1] Here in Australia, that should be gc.reverse_charges().



More information about the Python-list mailing list