@@ -72,30 +72,14 @@ extern void* emmalloc_memalign(size_t, size_t);
72
72
73
73
// Note: the `try_alignment` is just a hint and the returned pointer is not guaranteed to be aligned.
74
74
int _mi_prim_alloc (size_t size , size_t try_alignment , bool commit , bool allow_large , bool * is_large , bool * is_zero , void * * addr ) {
75
- MI_UNUSED (try_alignment ); MI_UNUSED ( allow_large ); MI_UNUSED (commit );
75
+ MI_UNUSED (allow_large ); MI_UNUSED (commit );
76
76
* is_large = false;
77
77
// TODO: Track the highest address ever seen; first uses of it are zeroes.
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
86
- #define MIN_EMMALLOC_ALIGN 8
87
- #define MAX_EMMALLOC_ALIGN (1024*1024)
88
- if (try_alignment < MIN_EMMALLOC_ALIGN ) {
89
- try_alignment = MIN_EMMALLOC_ALIGN ;
90
- } else if (try_alignment > MAX_EMMALLOC_ALIGN ) {
91
- try_alignment = MAX_EMMALLOC_ALIGN ;
92
- }
93
- void * p = emmalloc_memalign (try_alignment , size );
94
- * addr = p ;
95
- if (p == 0 ) {
96
- return ENOMEM ;
97
- }
98
- return 0 ;
81
+ * addr = emmalloc_memalign (try_alignment , size );
82
+ return (* addr != NULL ? 0 : ENOMEM );
99
83
}
100
84
101
85
0 commit comments