fixes #4818
This commit is contained in:
parent
4561d70632
commit
39ca8b8c8e
3 changed files with 43 additions and 3 deletions
|
|
@ -1,6 +1,5 @@
|
|||
discard """
|
||||
output: "ok"
|
||||
disabled: "true"
|
||||
"""
|
||||
|
||||
import tables, lists
|
||||
|
|
|
|||
21
tests/system/trealloc.nim
Normal file
21
tests/system/trealloc.nim
Normal 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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue