Memory usage per top 10x usage per heapy

Ian Kelly ian.g.kelly at gmail.com
Tue Sep 25 18:09:24 EDT 2012


On Tue, Sep 25, 2012 at 12:17 PM, Oscar Benjamin
<oscar.j.benjamin at gmail.com> wrote:
> Also I think lambda functions might be able to keep the frame alive. Are
> they by any chance being created in a function that is called in a loop?

I'm pretty sure they don't.  Closures don't keep a reference to the
calling frame, only to the appropriate cellvars.

Also note that whether a function is a closure has nothing to do with
whether it was defined by a lambda or a def statement.  In fact,
there's no difference between functions created by one vs. the other,
except that one has an interesting __name__ and the other does not.
:-)



More information about the Python-list mailing list