diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-02-13 08:04:06 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-13 08:04:06 +0100 |
commit | b6c22eae6a73438ca9bf48281090ce0958475e06 (patch) | |
tree | 101bf357ceda4dcbb8158e6aa6ec85fa3699b4cd /tests | |
parent | 6870345cd2af461d49159ad453c5f6437752d096 (diff) | |
download | Nim-b6c22eae6a73438ca9bf48281090ce0958475e06.tar.gz |
disable talloc2 on 32 bits (#10656)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/system/talloc2.nim | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/tests/system/talloc2.nim b/tests/system/talloc2.nim index 4958cda6d..a321fe741 100644 --- a/tests/system/talloc2.nim +++ b/tests/system/talloc2.nim @@ -1,46 +1,45 @@ discard """ disabled: "windows" joinable: false +disabled: 32bit """ - +# no point to test this on system with smaller address space # appveyor is "out of memory" -when sizeof(int) >= 8: - # no point to test this on system with smaller address space - const - nmax = 2*1024*1024*1024 +const + nmax = 2*1024*1024*1024 - proc test(n: int) = - var a = alloc0(9999) - var t = cast[ptr UncheckedArray[int8]](alloc(n)) - var b = alloc0(9999) - t[0] = 1 - t[1] = 2 - t[n-2] = 3 - t[n-1] = 4 - dealloc(a) - dealloc(t) - dealloc(b) +proc test(n: int) = + var a = alloc0(9999) + var t = cast[ptr UncheckedArray[int8]](alloc(n)) + var b = alloc0(9999) + t[0] = 1 + t[1] = 2 + t[n-2] = 3 + t[n-1] = 4 + dealloc(a) + dealloc(t) + dealloc(b) - # allocator adds 48 bytes to BigChunk - # BigChunk allocator edges at 2^n * (1 - s) for s = [1..32]/64 - proc test2(n: int) = - let d = n div 256 # cover edges and more - for i in countdown(128,1): - for j in [-4096, -64, -49, -48, -47, -32, 0, 4096]: - let b = n + j - i*d - if b>0 and b<=nmax: - test(b) - #echo b, ": ", getTotalMem(), " ", getOccupiedMem(), " ", getFreeMem() +# allocator adds 48 bytes to BigChunk +# BigChunk allocator edges at 2^n * (1 - s) for s = [1..32]/64 +proc test2(n: int) = + let d = n div 256 # cover edges and more + for i in countdown(128,1): + for j in [-4096, -64, -49, -48, -47, -32, 0, 4096]: + let b = n + j - i*d + if b>0 and b<=nmax: + test(b) + #echo b, ": ", getTotalMem(), " ", getOccupiedMem(), " ", getFreeMem() - proc test3 = - var n = 1 - while n <= nmax: - test2(n) - n *= 2 - n = nmax - while n >= 1: - test2(n) - n = n div 2 +proc test3 = + var n = 1 + while n <= nmax: + test2(n) + n *= 2 + n = nmax + while n >= 1: + test2(n) + n = n div 2 - test3() +test3() |