Source

thg-qt-mq / meliaedump.diff

# HG changeset patch
# Parent 3dab56f602e03b6476d27a5a4a2da3f096b9f2a3
diff --git a/tortoisehg/hgqt/run.py b/tortoisehg/hgqt/run.py
--- a/tortoisehg/hgqt/run.py
+++ b/tortoisehg/hgqt/run.py
@@ -19,6 +19,7 @@ import subprocess
 import traceback
 import zlib
 import gc
+from meliae import scanner
 
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
@@ -388,7 +389,10 @@ class GarbageCollector(QObject):
         self.timer.start(self.INTERVAL)
         #gc.set_debug(gc.DEBUG_SAVEALL)
 
+        self._checkcnt = 0
+
     def check(self):
+        self._checkcnt += 1
         #return self.debug_cycles()
         l0, l1, l2 = gc.get_count()
         if self.debug:
@@ -406,6 +410,10 @@ class GarbageCollector(QObject):
                     if self.debug:
                         print 'collecting gen 2, found:', num, 'unreachable'
 
+        if self.debug:
+            print 'dump to meliae-%d.json' % self._checkcnt
+            scanner.dump_all_objects('meliae-%d.json' % self._checkcnt)
+
     def debug_cycles(self):
         gc.collect()
         for obj in gc.garbage: