Author: Remi Meier <[email protected]>
Branch:
Changeset: r83533:ac58de5d526f
Date: 2016-04-06 10:13 +0300
http://bitbucket.org/pypy/pypy/changeset/ac58de5d526f/
Log: try to fix this test that previously used to enumerate all code objs
by tracing the heap and now uses a weakref list.
The difference is that weakrefs may point to unreachable objs and we
therefore count more than with the other method.
diff --git a/pypy/module/_vmprof/test/test__vmprof.py
b/pypy/module/_vmprof/test/test__vmprof.py
--- a/pypy/module/_vmprof/test/test__vmprof.py
+++ b/pypy/module/_vmprof/test/test__vmprof.py
@@ -14,7 +14,7 @@
tmpfile2 = open(self.tmpfilename2, 'wb')
tmpfileno2 = tmpfile2.fileno()
- import struct, sys
+ import struct, sys, gc
WORD = struct.calcsize('l')
@@ -46,6 +46,8 @@
return count
import _vmprof
+ gc.collect() # try to make the weakref list deterministic
+ gc.collect() # by freeing all dead code objects
_vmprof.enable(tmpfileno, 0.01)
_vmprof.disable()
s = open(self.tmpfilename, 'rb').read()
@@ -57,6 +59,8 @@
pass
""" in d
+ gc.collect()
+ gc.collect()
_vmprof.enable(tmpfileno2, 0.01)
exec """def foo2():
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit