diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-01-19 12:46:49 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-01-19 12:48:39 +0100 |
commit | f7c0360aba4e8ac2857adb85ff838d94cf30ff53 (patch) | |
tree | a14077770c2353680f3cdcaae335f68c2bfd7f6f /lib/system/alloc.nim | |
parent | 86a91c1a4a38a669e9ed5409975936f64ad3e532 (diff) | |
download | Nim-f7c0360aba4e8ac2857adb85ff838d94cf30ff53.tar.gz |
allocators: introduce --define:nimMinHeapPages for tuning mmap calls (omg they are slow on OSX...)
Diffstat (limited to 'lib/system/alloc.nim')
-rw-r--r-- | lib/system/alloc.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim index b090117a9..e938dc475 100644 --- a/lib/system/alloc.nim +++ b/lib/system/alloc.nim @@ -20,7 +20,7 @@ template track(op, address, size) = # Each chunk starts at an address that is divisible by the page size. const - InitialMemoryRequest = 128 * PageSize # 0.5 MB + nimMinHeapPages {.intdefine.} = 128 # 0.5 MB SmallChunkSize = PageSize MaxFli = 30 MaxLog2Sli = 5 # 32, this cannot be increased without changing 'uint32' @@ -588,8 +588,8 @@ proc getBigChunk(a: var MemRegion, size: int): PBigChunk = sysAssert((size and PageMask) == 0, "getBigChunk: unaligned chunk") result = findSuitableBlock(a, fl, sl) if result == nil: - if size < InitialMemoryRequest: - result = requestOsChunks(a, InitialMemoryRequest) + if size < nimMinHeapPages * PageSize: + result = requestOsChunks(a, nimMinHeapPages * PageSize) splitChunk(a, result, size) else: result = requestOsChunks(a, size) |