diff options
Diffstat (limited to 'tests/fragmentation/tfragment_alloc.nim')
-rw-r--r-- | tests/fragmentation/tfragment_alloc.nim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/fragmentation/tfragment_alloc.nim b/tests/fragmentation/tfragment_alloc.nim new file mode 100644 index 000000000..6ee8322c7 --- /dev/null +++ b/tests/fragmentation/tfragment_alloc.nim @@ -0,0 +1,19 @@ + + + +include system/ansi_c + +import strutils, data + +proc main = + var m = 0 + for i in 0..1000_000: + let size = sizes[i mod sizes.len] + let p = alloc(size) + if p == nil: + quit "could not serve request!" + dealloc p + # c_fprintf(stdout, "iteration: %ld size: %ld\n", i, size) + +main() +echo formatSize getOccupiedMem(), " / ", formatSize getTotalMem() |