[Twisted-Python] Woven application, objects not collected.

Andrew Bennetts andrew at puzzling.org
Tue Nov 25 08:19:19 EST 2003

On Wed, Nov 26, 2003 at 12:13:38AM +1100, Andrew Bennetts wrote:
> If we can find a good enough test case, we might be able to write a unit
> test to trigger it and then check gc.garbage, so that we can include it in
> the test suite and stop it from happening again.

Thinking about this further, I just wrote the following hack for trial:

bash-2.05b$ cvs diff -u twisted/scripts/trial.py
Index: twisted/scripts/trial.py
RCS file: /cvs/Twisted/twisted/scripts/trial.py,v
retrieving revision 1.51
diff -u -r1.51 trial.py
--- twisted/scripts/trial.py    17 Oct 2003 21:48:16 -0000      1.51
+++ twisted/scripts/trial.py    25 Nov 2003 13:17:02 -0000
@@ -328,6 +328,11 @@
                                suite.run, reporter, config['random'])
             suite.run(reporter, config['random'])
+    import gc
+    gc.collect()
+    if gc.garbage:
+        print "GARBAGE: %d objects" % len(gc.garbage)
+        print "GARBAGE: " + repr(gc.garbage)
     sys.exit(not reporter.allPassed())
 if __name__ == '__main__':

I've only just started playing with this, but none of the web or woven tests
show anything.  test_pb seems to leak a whole bunch of stuff, though...


More information about the Twisted-Python mailing list