Author: Armin Rigo <[email protected]>
Branch: gc-minimark-pinning
Changeset: r55056:c45e2cc383ff
Date: 2012-05-12 17:46 +0200
http://bitbucket.org/pypy/pypy/changeset/c45e2cc383ff/
Log: Fix the logic in maybe_collect_and_reserve().
diff --git a/pypy/rpython/memory/gc/minimark.py
b/pypy/rpython/memory/gc/minimark.py
--- a/pypy/rpython/memory/gc/minimark.py
+++ b/pypy/rpython/memory/gc/minimark.py
@@ -593,18 +593,19 @@
and finally reserve 'totalsize' bytes at the start of the
now-empty nursery.
"""
- if not self.nursery_top == self.nursery + self.nursery_size:
+ while self.nursery_barriers.non_empty():
+ # move over to the next contiguous block of memory
+ size_gc_header = self.gcheaderbuilder.size_gc_header
+ pinned_obj_size = size_gc_header + self.get_size(
+ self.nursery_top + size_gc_header)
+ self.nursery_free = self.nursery_top + pinned_obj_size
self.nursery_top = self.nursery_barriers.popleft()
- size_gc_header = self.gcheaderbuilder.size_gc_header
- while self.nursery_barriers.non_empty() and self.nursery_free +
totalsize > self.nursery_top:
- cur_obj_size = size_gc_header + self.get_size(
- self.nursery_top + size_gc_header)
- self.nursery_free = self.nursery_top + cur_obj_size
- self.nursery_top = self.nursery_barriers.popleft()
- if self.nursery_free + totalsize <= self.nursery_top:
- res = self.nursery_free
- self.nursery_free = res + totalsize
- return res
+ # try again
+ result = self.nursery_free
+ self.nursery_free = result + totalsize
+ if self.nursery_free <= self.nursery_top:
+ return result
+ #
self.minor_collection(totalsize)
# try allocating now, otherwise we do a major collect
do_major_collect = False
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit