[pypy-commit] pypy stm-gc: Add a non-passing test.

arigo noreply at buildbot.pypy.org
Sat Mar 31 17:58:41 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r54109:1396dcd47d1c
Date: 2012-03-31 17:01 +0200
http://bitbucket.org/pypy/pypy/changeset/1396dcd47d1c/

Log:	Add a non-passing test.

diff --git a/pypy/rpython/memory/gc/stmgc.py b/pypy/rpython/memory/gc/stmgc.py
--- a/pypy/rpython/memory/gc/stmgc.py
+++ b/pypy/rpython/memory/gc/stmgc.py
@@ -147,14 +147,13 @@
     def _allocate_bump_pointer(self, tls, size):
         free = tls.nursery_free
         top  = tls.nursery_top
-        new  = free + size
-        tls.nursery_free = new
-        if new > top:
-            free = self.local_collection(free)
+        if (top - free) < llmemory.raw_malloc_usage(size):
+            free = self.local_collection(size)
+        tls.nursery_free = free + size
         return free
 
     @dont_inline
-    def local_collection(self, oldfree):
+    def local_collection(self, size):
         raise MemoryError("nursery exhausted")   # XXX for now
 
 
diff --git a/pypy/rpython/memory/gc/test/test_stmgc.py b/pypy/rpython/memory/gc/test/test_stmgc.py
--- a/pypy/rpython/memory/gc/test/test_stmgc.py
+++ b/pypy/rpython/memory/gc/test/test_stmgc.py
@@ -588,3 +588,7 @@
         assert a == sr1_adr
         a = self.gc.stm_normalize_global(tr1_adr)
         assert a == sr1_adr
+
+    def test_alloc_a_lot_from_main_thread(self):
+        for i in range(1000):
+            sr1, sr1_adr = self.malloc(SR)


More information about the pypy-commit mailing list