[pypy-svn] r79397 - in pypy/trunk/pypy/rpython/memory/gc: . test
arigo at codespeak.net
arigo at codespeak.net
Tue Nov 23 15:33:53 CET 2010
Author: arigo
Date: Tue Nov 23 15:33:51 2010
New Revision: 79397
Modified:
pypy/trunk/pypy/rpython/memory/gc/env.py
pypy/trunk/pypy/rpython/memory/gc/minimark.py
pypy/trunk/pypy/rpython/memory/gc/test/test_env.py
Log:
Fix and test for the bound at 4GB.
Modified: pypy/trunk/pypy/rpython/memory/gc/env.py
==============================================================================
--- pypy/trunk/pypy/rpython/memory/gc/env.py (original)
+++ pypy/trunk/pypy/rpython/memory/gc/env.py Tue Nov 23 15:33:51 2010
@@ -87,6 +87,8 @@
result = addressable_size
else:
debug_print("memtotal =", result)
+ if result > addressable_size:
+ result = addressable_size
debug_stop("gc-hardware")
return result
Modified: pypy/trunk/pypy/rpython/memory/gc/minimark.py
==============================================================================
--- pypy/trunk/pypy/rpython/memory/gc/minimark.py (original)
+++ pypy/trunk/pypy/rpython/memory/gc/minimark.py Tue Nov 23 15:33:51 2010
@@ -25,8 +25,8 @@
PYPY_GC_MAX_DELTA The major collection threshold will never be set
to more than PYPY_GC_MAX_DELTA the amount really
used after a collection. Defaults to 1/8th of the
- total RAM size (or at most 4GB on 32-bit systems).
- Try values like '200MB'.
+ total RAM size (which is constrained to be at most
+ 4GB on 32-bit systems). Try values like '200MB'.
PYPY_GC_MIN Don't collect while the memory size is below this
limit. Useful to avoid spending all the time in
Modified: pypy/trunk/pypy/rpython/memory/gc/test/test_env.py
==============================================================================
--- pypy/trunk/pypy/rpython/memory/gc/test/test_env.py (original)
+++ pypy/trunk/pypy/rpython/memory/gc/test/test_env.py Tue Nov 23 15:33:51 2010
@@ -84,6 +84,24 @@
result = env.get_total_memory_linux2(str(filepath))
assert result == 1976804 * 1024
+def test_get_total_memory_linux2_32bit_limit():
+ filepath = udir.join('get_total_memory_linux2')
+ filepath.write("""\
+MemTotal: 3145728 kB
+etc.
+""")
+ saved = env.addressable_size
+ try:
+ env.addressable_size = float(2**31)
+ result = env.get_total_memory_linux2(str(filepath))
+ check_equal(result, float(2**31)) # limit hit
+ #
+ env.addressable_size = float(2**32)
+ result = env.get_total_memory_linux2(str(filepath))
+ check_equal(result, float(3145728 * 1024)) # limit not hit
+ finally:
+ env.addressable_size = saved
+
def test_estimate_best_nursery_size_linux2():
filepath = udir.join('estimate_best_nursery_size_linux2')
filepath.write("""\
More information about the Pypy-commit
mailing list