|
1 | 1 | /* ----------------------------------------------------------------------------
|
2 |
| -Copyright (c) 2018-2023, Microsoft Research, Daan Leijen |
| 2 | +Copyright (c) 2018-2023, Microsoft Research, Daan Leijen, Alon Zakai |
3 | 3 | This is free software; you can redistribute it and/or modify it under the
|
4 | 4 | terms of the MIT license. A copy of the license can be found in the file
|
5 | 5 | "LICENSE" at the root of this distribution.
|
@@ -78,17 +78,10 @@ int _mi_prim_alloc(size_t size, size_t try_alignment, bool commit, bool allow_la
|
78 | 78 | // That assumes no one else uses sbrk but us (they could go up,
|
79 | 79 | // scribble, and then down), but we could assert on that perhaps.
|
80 | 80 | *is_zero = false;
|
81 |
| - // emmalloc has some limitations on alignment size. |
82 |
| - // TODO: Why does mimalloc ask for an align of 4MB? that ends up allocating |
83 |
| - // 8, which wastes quite a lot for us in wasm. If that is unavoidable, |
84 |
| - // we may want to improve emmalloc to support such alignment. See also |
85 |
| - // https://github.com/emscripten-core/emscripten/issues/20645 |
| 81 | + // emmalloc has a minimum alignment size. |
86 | 82 | #define MIN_EMMALLOC_ALIGN 8
|
87 |
| - #define MAX_EMMALLOC_ALIGN (1024*1024) |
88 | 83 | if (try_alignment < MIN_EMMALLOC_ALIGN) {
|
89 | 84 | try_alignment = MIN_EMMALLOC_ALIGN;
|
90 |
| - } else if (try_alignment > MAX_EMMALLOC_ALIGN) { |
91 |
| - try_alignment = MAX_EMMALLOC_ALIGN; |
92 | 85 | }
|
93 | 86 | void* p = emmalloc_memalign(try_alignment, size);
|
94 | 87 | *addr = p;
|
@@ -249,4 +242,3 @@ void _mi_prim_thread_associate_default_heap(mi_heap_t* heap) {
|
249 | 242 |
|
250 | 243 | }
|
251 | 244 | #endif
|
252 |
| - |
0 commit comments