tests/basics/memoryerror: Add test for out-of-memory using realloc.
This commit is contained in:
parent
26d4a6fa45
commit
a1d85d6199
|
@ -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')
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
MemoryError
|
MemoryError
|
||||||
1000 0 999
|
1000 0 999
|
||||||
|
MemoryError
|
||||||
|
|
Loading…
Reference in New Issue