Rev 89: Change things a bit. If an object doesn't HAVE_GC, go ahead and dump anything it references. in http://bazaar.launchpad.net/~meliae-dev/meliae/trunk

John Arbash Meinel john at arbash-meinel.com
Wed Oct 7 21:54:54 BST 2009


At http://bazaar.launchpad.net/~meliae-dev/meliae/trunk

------------------------------------------------------------
revno: 89
revision-id: john at arbash-meinel.com-20091007205438-ptdk6k1k2rohfjpd
parent: john at arbash-meinel.com-20090930155221-3ry5yukopf2b565n
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Wed 2009-10-07 15:54:38 -0500
message:
  Change things a bit. If an object doesn't HAVE_GC, go ahead and dump anything it references.
  *and* recurse deeper.
  We do this because StaticTuple objects are not in the garbage collector, thus they won't
  be seen. It does mean we end up with a lot more redundant string data in the dump file.
  If only because those static tuples reference interned string objects, and thus the
  string objects get dumped via multiple paths...
  
  Anyway, this gives better detail when we have StaticTuples active, even if the final
  dump file was 4x larger than after stripping duplicates.
-------------- next part --------------
=== modified file 'meliae/_scanner_core.c'
--- a/meliae/_scanner_core.c	2009-09-30 15:52:21 +0000
+++ b/meliae/_scanner_core.c	2009-10-07 20:54:38 +0000
@@ -218,12 +218,16 @@
      * types have a traverse, but they won't be part of gc.get_objects().
      */
     if (Py_TYPE(c_obj)->tp_traverse == NULL
-        || (PyType_Check(c_obj)
-            && !PyType_HasFeature((PyTypeObject*)c_obj, Py_TPFLAGS_HEAPTYPE)))
+               || (PyType_Check(c_obj)
+               && !PyType_HasFeature((PyTypeObject*)c_obj, Py_TPFLAGS_HEAPTYPE)))
     {
         _dump_object_to_ref_info(info, c_obj, 0);
+    } else if (!PyType_HasFeature(Py_TYPE(c_obj), Py_TPFLAGS_HAVE_GC)) {
+        /* This object is not considered part of the garbage collector, even
+         * if it does [not] have a tp_traverse function.
+         */
+        _dump_object_to_ref_info(info, c_obj, 1);
     }
-    // We know that it is safe to recurse here, because tp_traverse is NULL
     return 0;
 }
 



More information about the bazaar-commits mailing list