Avoid allocating memory that will not be used in the test
This change avoids triggering the OOM-killer while loading this test.
@@ -20,6 +20,10 @@ _4GB = 0xffffffff # actually 4GB - 1B, the maximum size on 4 bytes.
# check for the TRAVIS environment variable being set. This is quite
# fragile.
+if os.environ.get('TRAVIS') is not None or sys.maxsize < _4GB or \
+ psutil.virtual_memory().available < _4GB:
+ huge = None
+else:
try:
huge = b'\0' * _4GB
except (MemoryError, OverflowError):
