mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-04 22:49:32 +03:00
Merge pull request #891 from kripken/no.min
Emscripten: Remove no-longer-needed minimum emmalloc alignment
This commit is contained in:
commit
f35355b2de
1 changed files with 1 additions and 8 deletions
|
@ -78,17 +78,10 @@ int _mi_prim_alloc(size_t size, size_t try_alignment, bool commit, bool allow_la
|
||||||
// That assumes no one else uses sbrk but us (they could go up,
|
// That assumes no one else uses sbrk but us (they could go up,
|
||||||
// scribble, and then down), but we could assert on that perhaps.
|
// scribble, and then down), but we could assert on that perhaps.
|
||||||
*is_zero = false;
|
*is_zero = false;
|
||||||
// emmalloc has some limitations on alignment size.
|
// emmalloc has a minimum alignment size.
|
||||||
// TODO: Why does mimalloc ask for an align of 4MB? that ends up allocating
|
|
||||||
// 8, which wastes quite a lot for us in wasm. If that is unavoidable,
|
|
||||||
// we may want to improve emmalloc to support such alignment. See also
|
|
||||||
// https://github.com/emscripten-core/emscripten/issues/20645
|
|
||||||
#define MIN_EMMALLOC_ALIGN 8
|
#define MIN_EMMALLOC_ALIGN 8
|
||||||
#define MAX_EMMALLOC_ALIGN (1024*1024)
|
|
||||||
if (try_alignment < MIN_EMMALLOC_ALIGN) {
|
if (try_alignment < MIN_EMMALLOC_ALIGN) {
|
||||||
try_alignment = MIN_EMMALLOC_ALIGN;
|
try_alignment = MIN_EMMALLOC_ALIGN;
|
||||||
} else if (try_alignment > MAX_EMMALLOC_ALIGN) {
|
|
||||||
try_alignment = MAX_EMMALLOC_ALIGN;
|
|
||||||
}
|
}
|
||||||
void* p = emmalloc_memalign(try_alignment, size);
|
void* p = emmalloc_memalign(try_alignment, size);
|
||||||
*addr = p;
|
*addr = p;
|
||||||
|
|
Loading…
Add table
Reference in a new issue