Author: Armin Rigo <[email protected]>
Branch:
Changeset: r909:b8042cd71968
Date: 2014-03-01 17:14 +0100
http://bitbucket.org/pypy/stmgc/changeset/b8042cd71968/
Log: Next test
diff --git a/c7/stm/largemalloc.c b/c7/stm/largemalloc.c
--- a/c7/stm/largemalloc.c
+++ b/c7/stm/largemalloc.c
@@ -463,8 +463,8 @@
survives or dies */
if (!_largemalloc_sweep_keep(chunk)) {
size_t size = chunk->size;
+ increment_total_allocated(-(size + LARGE_MALLOC_OVERHEAD));
_stm_large_free((char *)&chunk->d); /* dies */
- increment_total_allocated(-(size + LARGE_MALLOC_OVERHEAD));
}
chunk = mnext;
}
diff --git a/c7/test/support.py b/c7/test/support.py
--- a/c7/test/support.py
+++ b/c7/test/support.py
@@ -77,7 +77,7 @@
GC_N_SMALL_REQUESTS = 36 # from gcpage.c
SHARED_PAGE = 1 # from pages.h
PRIVATE_PAGE = 3 # from pages.h
-
+LARGE_MALLOC_OVERHEAD = 16 # from largemalloc.h
lib = ffi.verify('''
#include <stdlib.h>
diff --git a/c7/test/test_gcpage.py b/c7/test/test_gcpage.py
--- a/c7/test/test_gcpage.py
+++ b/c7/test/test_gcpage.py
@@ -1,6 +1,10 @@
from support import *
import py
+
+LMO = LARGE_MALLOC_OVERHEAD
+
+
class TestGCPage(BaseTest):
def test_large_obj_alloc(self):
@@ -93,11 +97,29 @@
new = stm_allocate(5000)
self.push_root(new)
stm_minor_collect()
- assert 5000 <= lib._stm_total_allocated() <= 8192
+ assert lib._stm_total_allocated() == 5000 + LMO
self.pop_root()
stm_minor_collect()
- assert 5000 <= lib._stm_total_allocated() <= 8192
+ assert lib._stm_total_allocated() == 5000 + LMO
stm_major_collect()
assert lib._stm_total_allocated() == 0
+
+ def test_mark_recursive(self):
+ def make_chain(sz):
+ prev = ffi.cast("object_t *", ffi.NULL)
+ for i in range(10):
+ self.push_root(prev)
+ new = stm_allocate_refs(sz/8-1)
+ prev = self.pop_root()
+ stm_set_ref(new, 42, prev)
+ prev = new
+ return new
+
+ self.start_transaction()
+ self.push_root(make_chain(5000))
+ self.push_root(make_chain(4312))
+ stm_minor_collect()
+ assert lib._stm_total_allocated() == (10 * (5000 + LMO) +
+ 10 * (4312 + LMO))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit