[docs] [issue33814] exec() maybe has a memory leak
report at bugs.python.org
Sat Jun 9 20:07:37 EDT 2018
Steven D'Aprano <steve+python at pearwood.info> added the comment:
Perhaps a little less self-righteous anger and a little more detail on this alleged bug would be appropriate.
I still think it's ridiculous that every item added to that dict has an "extra", non-obvious reference count that is impossible to vanquish of from within Python.
Have you demonstrated that this is the case? How do you know that is what is happening?
I intuited leaving `locals` blank will do what usually happens when functions take optional arguments, and *usually* that is *not* the triggering of a "hidden" memory leak.
Have you demonstrated a memory leak? What is your intuition for what leaving locals blank should do? Did you try running the code without leaving locals blank?
the supposed justification for `exec`'s ability to very easily trigger a catastrophic memory leak
I wouldn't call your example code "very easily", nor do I know what "supposed justification" you are referring to. I read the docs for exec here
and I see nothing justifying memory leaks or even mentioning them. Are you reading some other documentation?
Is this the shortest, simplest demonstration of the leak you can come up with? What output do you get and what output did you expect?
If it necessary for repeat to be imported under the name "reeeee" over and over again? What do weakrefs have to do with this?
You call this a "catastrophic" memory leak, I don't know whether this is mere hyperbole or something that will lock up or crash my computer when I run it.
Python tracker <report at bugs.python.org>
More information about the docs