[pypy-commit] pypy gc-incminimark-pinning-improve: add environment variable to set the maximum number of pinned objects
groggi
noreply at buildbot.pypy.org
Mon Mar 23 15:24:08 CET 2015
Author: Gregor Wegberg <code at gregorwegberg.com>
Branch: gc-incminimark-pinning-improve
Changeset: r76528:a3b1ea41b1f9
Date: 2015-03-23 15:23 +0100
http://bitbucket.org/pypy/pypy/changeset/a3b1ea41b1f9/
Log: add environment variable to set the maximum number of pinned objects
If set to zero no object can be pinned. This can be useful to
quickly check if a problem is because of pinning or not.
diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -56,6 +56,7 @@
# XXX try merging old_objects_pointing_to_pinned into
# XXX old_objects_pointing_to_young (IRC 2014-10-22, fijal and gregor_w)
import sys
+import os
from rpython.rtyper.lltypesystem import lltype, llmemory, llarena, llgroup
from rpython.rtyper.lltypesystem.lloperation import llop
from rpython.rtyper.lltypesystem.llmemory import raw_malloc_usage
@@ -463,9 +464,19 @@
self.nursery_size = newsize
self.allocate_nursery()
#
- # Estimate this number conservatively
- bigobj = self.nonlarge_max + 1
- self.max_number_of_pinned_objects = self.nursery_size / (bigobj * 2)
+ max_number_of_pinned_objects = os.environ.get('PYPY_GC_MAX_PINNED')
+ if max_number_of_pinned_objects:
+ try:
+ max_number_of_pinned_objects = int(max_number_of_pinned_objects)
+ except ValueError:
+ max_number_of_pinned_objects = 0
+ #
+ if max_number_of_pinned_objects >= 0: # 0 allows to disable pinning completely
+ self.max_number_of_pinned_objects = max_number_of_pinned_objects
+ else:
+ # Estimate this number conservatively
+ bigobj = self.nonlarge_max + 1
+ self.max_number_of_pinned_objects = self.nursery_size / (bigobj * 2)
def _nursery_memory_size(self):
extra = self.nonlarge_max + 1
More information about the pypy-commit
mailing list