[pypy-svn] r17168 - pypy/dist/pypy/interpreter
tismer at codespeak.net
tismer at codespeak.net
Fri Sep 2 16:36:53 CEST 2005
Author: tismer
Date: Fri Sep 2 16:36:51 2005
New Revision: 17168
Modified:
pypy/dist/pypy/interpreter/eval.py
pypy/dist/pypy/interpreter/pyframe.py
Log:
About this pseudo-memory-leak
-----------------------------
dropping frame.last_exception after leaving it.
This solves the problem that we get memory leaks on every
applevel expcetion if we have to GC at hand. This is the
only obvious circle that we have, and it is also not necessary
and not conforming to the CPython implementation,
which too clears exception state from frames when they are
not executing.
One might argue that I should have put this into pyframe.py
instead of eval; feel free to do so.
My reason was: the eval loop of pyframe is already very deeply
nested, and I would have to add another finally clause, which not
onlymade it less readable, but gave a measurable performance hit.
Putting it into the resume method is cheap, because we have
a finally clause there, anyway.
It does logically not really belong there, so I could understand
if somebody's aesthetics is disturbed and he moves it to frame.eval
Modified: pypy/dist/pypy/interpreter/eval.py
==============================================================================
--- pypy/dist/pypy/interpreter/eval.py (original)
+++ pypy/dist/pypy/interpreter/eval.py Fri Sep 2 16:36:51 2005
@@ -144,6 +144,10 @@
try:
result = self.eval(executioncontext)
finally:
+ # on exit, we always release self.last_exception.
+ # this belongs into pyframe's eval, but would cost an extra
+ # try..except clause there which we can save.
+ self.last_exception = None
executioncontext.leave(self)
return result
Modified: pypy/dist/pypy/interpreter/pyframe.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyframe.py (original)
+++ pypy/dist/pypy/interpreter/pyframe.py Fri Sep 2 16:36:51 2005
@@ -125,10 +125,8 @@
# leave that frame
w_exitvalue = e.w_exitvalue
executioncontext.return_trace(self, w_exitvalue)
- # on exit, always release self.last_exception in case of no GC
- self.last_exception = None
return w_exitvalue
-
+
### line numbers ###
# for f*_f_* unwrapping through unwrap_spec in typedef.py
More information about the Pypy-commit
mailing list