[pypy-svn] r68967 - pypy/branch/gc-jit-hack/pypy/rpython/memory/gc

arigo at codespeak.net arigo at codespeak.net
Wed Nov 4 11:38:13 CET 2009


Author: arigo
Date: Wed Nov  4 11:38:13 2009
New Revision: 68967

Modified:
   pypy/branch/gc-jit-hack/pypy/rpython/memory/gc/generation.py
   pypy/branch/gc-jit-hack/pypy/rpython/memory/gc/semispace.py
Log:
In record_red_zone() we know that the nursery is going
to be allocated very soon, and it was already allocated
previously.  So it should really be counted as part of
the allocated objects.  The result is that we resize
the semispaces a bit more eagerly.


Modified: pypy/branch/gc-jit-hack/pypy/rpython/memory/gc/generation.py
==============================================================================
--- pypy/branch/gc-jit-hack/pypy/rpython/memory/gc/generation.py	(original)
+++ pypy/branch/gc-jit-hack/pypy/rpython/memory/gc/generation.py	Wed Nov  4 11:38:13 2009
@@ -265,6 +265,11 @@
         self.reset_nursery()
         SemiSpaceGC.semispace_collect(self, size_changing)
 
+    def record_red_zone(self, overhead=0):
+        if not self.nursery:
+            overhead += self.next_nursery_size
+        SemiSpaceGC.record_red_zone(self, overhead)
+
     def make_a_copy(self, obj, objsize):
         tid = self.header(obj).tid
         # During a full collect, all copied objects might implicitly come

Modified: pypy/branch/gc-jit-hack/pypy/rpython/memory/gc/semispace.py
==============================================================================
--- pypy/branch/gc-jit-hack/pypy/rpython/memory/gc/semispace.py	(original)
+++ pypy/branch/gc-jit-hack/pypy/rpython/memory/gc/semispace.py	Wed Nov  4 11:38:13 2009
@@ -283,14 +283,14 @@
     def finished_full_collect(self):
         pass    # hook for the HybridGC
 
-    def record_red_zone(self):
+    def record_red_zone(self, overhead=0):
         # red zone: if the space is more than 80% full, the next collection
         # should double its size.  If it is more than 66% full twice in a row,
         # then it should double its size too.  (XXX adjust)
         # The goal is to avoid many repeated collection that don't free a lot
         # of memory each, if the size of the live object set is just below the
         # size of the space.
-        free_after_collection = self.top_of_space - self.free
+        free_after_collection = self.top_of_space - self.free - overhead
         if free_after_collection > self.space_size // 3:
             self.red_zone = 0
         else:



More information about the Pypy-commit mailing list