2017-12-20 00:58:27 -05:00
|
|
|
# test out-of-memory with malloc
|
2015-06-24 04:43:09 -04:00
|
|
|
l = list(range(1000))
|
2014-04-15 22:28:40 -04:00
|
|
|
try:
|
2015-06-24 04:43:09 -04:00
|
|
|
1000000000 * l
|
2014-04-15 22:28:40 -04:00
|
|
|
except MemoryError:
|
|
|
|
print('MemoryError')
|
|
|
|
print(len(l), l[0], l[-1])
|
2017-12-20 00:58:27 -05:00
|
|
|
|
|
|
|
# test out-of-memory with realloc
|
|
|
|
try:
|
|
|
|
[].extend(range(1000000000))
|
|
|
|
except MemoryError:
|
|
|
|
print('MemoryError')
|