mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
add os cache to arena
This commit is contained in:
parent
268698b9ef
commit
b04206a9d3
5 changed files with 115 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
/* ----------------------------------------------------------------------------
|
||||
Copyright (c) 2018,2019 Microsoft Research, Daan Leijen
|
||||
This is free software; you can redistribute it and/or modify it under the
|
||||
terms of the MIT license.
|
||||
|
@ -64,9 +64,9 @@ static bool chance(size_t perc, random_t r) {
|
|||
|
||||
static void* alloc_items(size_t items, random_t r) {
|
||||
if (chance(1, r)) {
|
||||
if (chance(1,r)) items *= 1000; // 0.01% giant
|
||||
else if (chance(10,r)) items *= 100; // 0.1% huge
|
||||
else items *= 10; // 1% large objects;
|
||||
if (chance(1, r)) items *= 1000; // 0.01% giant
|
||||
else if (chance(10, r)) items *= 100; // 0.1% huge
|
||||
else items *= 10; // 1% large objects;
|
||||
}
|
||||
if (items==40) items++; // pthreads uses that size for stack increases
|
||||
uintptr_t* p = (uintptr_t*)mi_malloc(items*sizeof(uintptr_t));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue