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