commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7395 - trunk/gnue-common/src/apps


From: johannes
Subject: [gnue] r7395 - trunk/gnue-common/src/apps
Date: Mon, 18 Apr 2005 07:48:49 -0500 (CDT)

Author: johannes
Date: 2005-04-18 07:48:48 -0500 (Mon, 18 Apr 2005)
New Revision: 7395

Modified:
   trunk/gnue-common/src/apps/GBaseApp.py
Log:
Always free refs in gc.garbage


Modified: trunk/gnue-common/src/apps/GBaseApp.py
===================================================================
--- trunk/gnue-common/src/apps/GBaseApp.py      2005-04-18 12:40:09 UTC (rev 
7394)
+++ trunk/gnue-common/src/apps/GBaseApp.py      2005-04-18 12:48:48 UTC (rev 
7395)
@@ -844,38 +844,41 @@
       # If we are interested in the objects collected by the garbage collection
       # set the debug level to gc.DEBUG_LEAK. In this case gc.garbage contains
       # all objects, collectable and uncollectable as well and we are able to
-      # inspect those cycles and objects. Please not to free all items in
-      # gc.garbage afterwards (i.e. del gc.garbage [:]).
+      # inspect those cycles and objects.
       gc.collect ()
 
       self.__gcLog (log, "Number of unreachable objects: %d" % len 
(gc.garbage))
       if not gc.garbage:
         return
 
-      self.__gcLog (log, "Dump of gc.garbage sequence:")
-      self.__gcLog (log, "-" * 70)
+      try:
+        self.__gcLog (log, "Dump of gc.garbage sequence:")
+        self.__gcLog (log, "-" * 70)
 
-      for item in gc.garbage:
-        try:
-          itemrep = "%s: %s" % (type (item), repr (item))
-          cycle   = self.findCycle (item, item)
+        for item in gc.garbage:
+          try:
+            itemrep = "%s: %s" % (type (item), repr (item))
+            cycle   = self.findCycle (item, item)
 
-        except:
-          itemrep = "No representation available for object (weakref/proxy?)"
-          cycle   = None
+          except:
+            itemrep = "No representation available for object (weakref/proxy?)"
+            cycle   = None
 
-        self.__gcLog (log, "%s" % itemrep)
+          self.__gcLog (log, "%s" % itemrep)
 
-        if cycle:
-          self.__gcLog (log, "=" * 70)
+          if cycle:
+            self.__gcLog (log, "=" * 70)
 
-          for line in self.analyzeCycle (cycle):
-            self.__gcLog (log, line)
+            for line in self.analyzeCycle (cycle):
+              self.__gcLog (log, line)
 
-          self.__gcLog (log, "=" * 70)
+            self.__gcLog (log, "=" * 70)
 
-      self.__gcLog (log, "-" * 70)
+        self.__gcLog (log, "-" * 70)
 
+      finally:
+        del gc.garbage [:]
+
     finally:
       log.close ()
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]