[pypy-commit] pypy concurrent-marksweep: Fix a subtle bug.

arigo noreply at buildbot.pypy.org
Wed Oct 12 21:37:09 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: concurrent-marksweep
Changeset: r47975:a38dcb8b3c18
Date: 2011-10-12 15:28 +0200
http://bitbucket.org/pypy/pypy/changeset/a38dcb8b3c18/

Log:	Fix a subtle bug.

diff --git a/pypy/rpython/memory/gc/concurrentms.py b/pypy/rpython/memory/gc/concurrentms.py
--- a/pypy/rpython/memory/gc/concurrentms.py
+++ b/pypy/rpython/memory/gc/concurrentms.py
@@ -567,7 +567,10 @@
             #
             debug_stop("gc-stop")
             #
-            self.execute_finalizers_ll()
+            # We must *not* run execute_finalizers_ll() here, because it
+            # can start the next collection, and then this function returns
+            # with a collection in progress, which it should not.  Be careful
+            # to call execute_finalizers_ll() in the caller somewhere.
 
 
     def execute_finalizers_ll(self):
@@ -608,6 +611,7 @@
             self.trigger_next_collection()
             if gen >= 2:
                 self.wait_for_the_end_of_collection()
+        self.execute_finalizers_ll()
 
     def trigger_next_collection(self):
         """In the mutator thread: triggers the next collection."""
@@ -662,6 +666,8 @@
         self.release(self.ready_to_start_lock)
         #
         debug_stop("gc-start")
+        #
+        self.execute_finalizers_ll()
 
     def _add_stack_root(self, root):
         obj = root.address[0]


More information about the pypy-commit mailing list