Mercurial > pydertron
changeset 5:c11c84274192
Added memory leak detection.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 10 Sep 2009 00:15:57 -0700 |
parents | ae5869491e61 |
children | 97adec8c8127 |
files | pydertron.py |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pydertron.py Wed Sep 09 22:18:35 2009 -0700 +++ b/pydertron.py Thu Sep 10 00:15:57 2009 -0700 @@ -538,5 +538,14 @@ globals = {'print': jsprint} loader = SecurableModuleLoader(sandbox, "modules", globals) - sandbox.run_script('test.js') + retval = sandbox.run_script('test.js') sandbox.finish() + del sandbox + del loader + + import gc + gc.collect() + if pydermonkey.get_debug_info()['runtime_count']: + print "WARNING: JS runtime was not destroyed." + + sys.exit(retval)