tests/basics/memoryerror: Add test for out-of-memory using realloc.

This commit is contained in:
Damien George 2017-12-20 16:58:27 +11:00
parent 26d4a6fa45
commit a1d85d6199
2 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,13 @@
# test out-of-memory with malloc
l = list(range(1000)) l = list(range(1000))
try: try:
1000000000 * l 1000000000 * l
except MemoryError: except MemoryError:
print('MemoryError') print('MemoryError')
print(len(l), l[0], l[-1]) print(len(l), l[0], l[-1])
# test out-of-memory with realloc
try:
[].extend(range(1000000000))
except MemoryError:
print('MemoryError')

View File

@ -1,2 +1,3 @@
MemoryError MemoryError
1000 0 999 1000 0 999
MemoryError