From: <pj...@us...> - 2009-06-05 04:40:11
|
Revision: 6450 http://jython.svn.sourceforge.net/jython/?rev=6450&view=rev Author: pjenvey Date: 2009-06-05 04:39:58 +0000 (Fri, 05 Jun 2009) Log Message: ----------- document the cause of test_getweakrefs: the compiler Modified Paths: -------------- trunk/jython/Lib/test/test_weakref.py trunk/jython/src/org/python/compiler/CodeCompiler.java Modified: trunk/jython/Lib/test/test_weakref.py =================================================================== --- trunk/jython/Lib/test/test_weakref.py 2009-06-04 07:29:23 UTC (rev 6449) +++ trunk/jython/Lib/test/test_weakref.py 2009-06-05 04:39:58 UTC (rev 6450) @@ -338,11 +338,10 @@ del ref2 extra_collect() if test_support.is_jython: - # XXX: Likely a Jython bug: the following inline declared - # [ref1] list isn't garbage collected no matter how many - # times we force gc.collect(), which prevents ref1 from - # being garbage collected after it's del'd below. So we - # explicitly delete our list + # XXX: Jython bug: the compiler creates a hard reference to + # the following inline declared [ref1] during + # 'weakref.getweakrefs(o) == [ref1]'. See + # CodeCompiler.makeArray for more info ref1_list = [ref1] self.assert_(weakref.getweakrefs(o) == ref1_list, #self.assert_(weakref.getweakrefs(o) == [ref1], Modified: trunk/jython/src/org/python/compiler/CodeCompiler.java =================================================================== --- trunk/jython/src/org/python/compiler/CodeCompiler.java 2009-06-04 07:29:23 UTC (rev 6449) +++ trunk/jython/src/org/python/compiler/CodeCompiler.java 2009-06-05 04:39:58 UTC (rev 6450) @@ -323,6 +323,11 @@ } public int makeArray(java.util.List<? extends PythonTree> nodes) throws Exception { + // XXX: This should produce an array on the stack (if possible) instead of a local + // the caller is responsible for freeing. All callers are incorrectly freeing the + // array reference -- they do call freeLocal, but without nullifying the reference + // in the local. This is causing short term memory leaks + // (e.g. test_weakref.test_getweakrefs) int n; if (nodes == null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |