This commit is contained in:
Araq 2016-12-18 23:11:53 +01:00
commit 39ca8b8c8e
3 changed files with 43 additions and 3 deletions

View file

@ -1,6 +1,5 @@
discard """
output: "ok"
disabled: "true"
"""
import tables, lists

21
tests/system/trealloc.nim Normal file
View file

@ -0,0 +1,21 @@
discard """
output: '''success'''
"""
# bug #4818
# Test that this completes without OOM.
const BUFFER_SIZE = 5000
var buffer = cast[ptr uint16](alloc(BUFFER_SIZE))
var total_size: int64 = 0
for i in 0 .. 4000:
let size = BUFFER_SIZE * i
#echo "requesting ", size
total_size += size.int64
buffer = cast[ptr uint16](realloc(buffer, size))
#echo totalSize, " total: ", getTotalMem(), " occupied: ", getOccupiedMem(), " free: ", getFreeMem()
dealloc(buffer)
echo "success"