Issue #19886: Use better estimated memory requirements for bigmem tests.

Incorrect requirements can cause memory swapping.
This commit is contained in:
Serhiy Storchaka 2014-01-10 13:39:27 +02:00
commit 786ac7b27d
6 changed files with 27 additions and 35 deletions

View file

@ -21,8 +21,6 @@ from pickle import bytes_types
# kind of outer loop.
protocols = range(pickle.HIGHEST_PROTOCOL + 1)
ascii_char_size = 1
# Return True if opcode code appears in the pickle, else False.
def opcode_in_pickle(code, pickle):
@ -1643,7 +1641,7 @@ class BigmemPickleTests(unittest.TestCase):
# Binary protocols can serialize longs of up to 2GB-1
@bigmemtest(size=_2G, memuse=1 + 1, dry_run=False)
@bigmemtest(size=_2G, memuse=3.6, dry_run=False)
def test_huge_long_32b(self, size):
data = 1 << (8 * size)
try:
@ -1660,7 +1658,7 @@ class BigmemPickleTests(unittest.TestCase):
# (older protocols don't have a dedicated opcode for bytes and are
# too inefficient)
@bigmemtest(size=_2G, memuse=1 + 1, dry_run=False)
@bigmemtest(size=_2G, memuse=2.5, dry_run=False)
def test_huge_bytes_32b(self, size):
data = b"abcd" * (size // 4)
try:
@ -1681,7 +1679,7 @@ class BigmemPickleTests(unittest.TestCase):
finally:
data = None
@bigmemtest(size=_4G, memuse=1 + 1, dry_run=False)
@bigmemtest(size=_4G, memuse=2.5, dry_run=False)
def test_huge_bytes_64b(self, size):
data = b"acbd" * (size // 4)
try:
@ -1711,7 +1709,7 @@ class BigmemPickleTests(unittest.TestCase):
# All protocols use 1-byte per printable ASCII character; we add another
# byte because the encoded form has to be copied into the internal buffer.
@bigmemtest(size=_2G, memuse=2 + ascii_char_size, dry_run=False)
@bigmemtest(size=_2G, memuse=8, dry_run=False)
def test_huge_str_32b(self, size):
data = "abcd" * (size // 4)
try:
@ -1738,7 +1736,7 @@ class BigmemPickleTests(unittest.TestCase):
# of utf-8 encoded unicode. BINUNICODE8 (protocol 4) supports these huge
# unicode strings however.
@bigmemtest(size=_4G, memuse=2 + ascii_char_size, dry_run=False)
@bigmemtest(size=_4G, memuse=8, dry_run=False)
def test_huge_str_64b(self, size):
data = "abcd" * (size // 4)
try: