mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
enable fragmentation tests
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
|
||||
|
||||
|
||||
include system/ansi_c
|
||||
discard """
|
||||
output: '''occupied ok: true
|
||||
total ok: true'''
|
||||
"""
|
||||
|
||||
import strutils, data
|
||||
|
||||
@@ -16,4 +17,11 @@ proc main =
|
||||
# c_fprintf(stdout, "iteration: %ld size: %ld\n", i, size)
|
||||
|
||||
main()
|
||||
echo formatSize getOccupiedMem(), " / ", formatSize getTotalMem()
|
||||
|
||||
let occ = getOccupiedMem()
|
||||
let total = getTotalMem()
|
||||
|
||||
# Current values on Win64: 824KiB / 106.191MiB
|
||||
|
||||
echo "occupied ok: ", occ < 2 * 1024 * 1024
|
||||
echo "total ok: ", total < 120 * 1024 * 1024
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
|
||||
|
||||
|
||||
#include system/ansi_c
|
||||
discard """
|
||||
output: '''occupied ok: true
|
||||
total ok: true'''
|
||||
"""
|
||||
|
||||
import strutils, data
|
||||
|
||||
proc main =
|
||||
var m = 0
|
||||
for i in 0..1000_000:
|
||||
# Since the GC test is slower than the alloc test, we only iterate 100_000 times here:
|
||||
for i in 0..100_000:
|
||||
let size = sizes[i mod sizes.len]
|
||||
let p = newString(size)
|
||||
# c_fprintf(stdout, "iteration: %ld size: %ld\n", i, size)
|
||||
|
||||
main()
|
||||
echo formatSize getOccupiedMem(), " / ", formatSize getTotalMem()
|
||||
|
||||
let occ = getOccupiedMem()
|
||||
let total = getTotalMem()
|
||||
|
||||
# Concrete values on Win64: 58.152MiB / 188.285MiB
|
||||
|
||||
echo "occupied ok: ", occ < 60 * 1024 * 1024
|
||||
echo "total ok: ", total < 200 * 1024 * 1024
|
||||
|
||||
Reference in New Issue
Block a user