[pypy-svn] r70968 - pypy/trunk/pypy/rpython/memory/gc
pedronis at codespeak.net
pedronis at codespeak.net
Fri Jan 29 15:01:58 CET 2010
Author: pedronis
Date: Fri Jan 29 15:01:57 2010
New Revision: 70968
Modified:
pypy/trunk/pypy/rpython/memory/gc/hybrid.py
Log:
(fijal, pedronis) tweak heuristic to collect less often
Modified: pypy/trunk/pypy/rpython/memory/gc/hybrid.py
==============================================================================
--- pypy/trunk/pypy/rpython/memory/gc/hybrid.py (original)
+++ pypy/trunk/pypy/rpython/memory/gc/hybrid.py Fri Jan 29 15:01:57 2010
@@ -236,11 +236,7 @@
def malloc_varsize_marknsweep(self, totalsize):
# In order to free the large objects from time to time, we
# arbitrarily force a full collect() if none occurs when we have
- # allocated 'self.space_size' bytes of large objects.
- # XXX we should probably track the total raw_malloc'ed size
- # XXX and adjust sizes based on it; otherwise we risk doing
- # XXX many many collections if the program allocates a lot
- # XXX more than the current self.space_size.
+ # allocated self.space_size + rawmalloced bytes of large objects.
self._check_rawsize_alloced(raw_malloc_usage(totalsize))
result = self.allocate_external_object(totalsize)
if not result:
@@ -417,13 +413,13 @@
debug_print("| [hybrid] made nonmoving: ",
self._nonmoving_copy_size, "bytes in",
self._nonmoving_copy_count, "objs")
+ rawmalloced_trigger = 0
# sweep the nonmarked rawmalloced objects
if self.is_collecting_gen3():
- self.sweep_rawmalloced_objects(generation=3)
- self.sweep_rawmalloced_objects(generation=2)
- # As we just collected, it's fine to raw_malloc'ate up to space_size
- # bytes again before we should force another collect.
- self.large_objects_collect_trigger = self.space_size
+ rawmalloced_trigger += self.sweep_rawmalloced_objects(generation=3)
+ rawmalloced_trigger += self.sweep_rawmalloced_objects(generation=2)
+ self.large_objects_collect_trigger = (rawmalloced_trigger +
+ self.space_size)
if self.is_collecting_gen3():
self.count_semispaceonly_collects = 0
self._initial_trigger = self.large_objects_collect_trigger
@@ -452,7 +448,7 @@
self.last_generation_root_objects = newgen3roots
else:
ll_assert(False, "bogus 'generation'")
- return
+ return 0 # to please the flowspace
surviving_objects = self.AddressStack()
# Help the flow space
@@ -470,7 +466,7 @@
else:
if debug:
alive_count+=1
- alive_size+=raw_malloc_usage(self.get_size_incl_hash(obj))
+ alive_size+=raw_malloc_usage(self.get_size_incl_hash(obj))
if generation == 3:
surviving_objects.append(obj)
elif generation == 2:
@@ -500,6 +496,7 @@
"nonmoving freed: ",
dead_size, "bytes in",
dead_count, "objs")
+ return alive_size
def id(self, ptr):
obj = llmemory.cast_ptr_to_adr(ptr)
More information about the Pypy-commit
mailing list