[pypy-commit] pypy default: issue1769: trying to increase some limits in the SWEEPING phase. Now it

arigo noreply at buildbot.pypy.org
Fri May 16 20:35:51 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r71541:8f47f3e1de79
Date: 2014-05-16 20:35 +0200
http://bitbucket.org/pypy/pypy/changeset/8f47f3e1de79/

Log:	issue1769: trying to increase some limits in the SWEEPING phase.
	Now it should be guaranteed that most steps during this phase should
	walk (and possibly free) at least '3 * nursery_size' bytes. More
	precisely, that's all steps but two of them, at the end of the two
	halves of this phase.

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -1861,20 +1861,26 @@
             #END MARKING
         elif self.gc_state == STATE_SWEEPING:
             #
-            # Walk all rawmalloced objects and free the ones that don't
-            # have the GCFLAG_VISITED flag.  Visit at most 'limit' objects.
-            limit = self.nursery_size // self.ac.page_size
-            remaining = self.free_unvisited_rawmalloc_objects_step(limit)
-            #
-            # Ask the ArenaCollection to visit a fraction of the objects.
-            # Free the ones that have not been visited above, and reset
-            # GCFLAG_VISITED on the others.  Visit at most '3 * limit'
-            # pages minus the number of objects already visited above.
-            done = self.ac.mass_free_incremental(self._free_if_unvisited,
-                                                 2 * limit + remaining)
+            if self.raw_malloc_might_sweep.non_empty():
+                # Walk all rawmalloced objects and free the ones that don't
+                # have the GCFLAG_VISITED flag.  Visit at most 'limit' objects.
+                # This limit is conservatively high enough to guarantee that
+                # a total object size of at least '3 * nursery_size' bytes
+                # is processed.
+                limit = 3 * self.nursery_size // self.small_request_threshold
+                self.free_unvisited_rawmalloc_objects_step(limit)
+                done = False    # the 2nd half below must still be done
+            else:
+                # Ask the ArenaCollection to visit a fraction of the objects.
+                # Free the ones that have not been visited above, and reset
+                # GCFLAG_VISITED on the others.  Visit at most '3 *
+                # nursery_size' bytes.
+                limit = 3 * self.nursery_size // self.ac.page_size
+                done = self.ac.mass_free_incremental(self._free_if_unvisited,
+                                                     limit)
             # XXX tweak the limits above
             #
-            if remaining > 0 and done:
+            if done:
                 self.num_major_collects += 1
                 #
                 # We also need to reset the GCFLAG_VISITED on prebuilt GC objects.


More information about the pypy-commit mailing list