Note: the `try_alignment` is just a hint and the returned pointer is not guaranteed to be aligned.
| 75 | |
| 76 | // Note: the `try_alignment` is just a hint and the returned pointer is not guaranteed to be aligned. |
| 77 | int _mi_prim_alloc(void* hint_addr, size_t size, size_t try_alignment, bool commit, bool allow_large, bool* is_large, bool* is_zero, void** addr) { |
| 78 | MI_UNUSED(allow_large); MI_UNUSED(commit); MI_UNUSED(hint_addr); |
| 79 | *is_large = false; |
| 80 | // TODO: Track the highest address ever seen; first uses of it are zeroes. |
| 81 | // That assumes no one else uses sbrk but us (they could go up, |
| 82 | // scribble, and then down), but we could assert on that perhaps. |
| 83 | *is_zero = false; |
| 84 | // emmalloc has a minimum alignment size. |
| 85 | #define MIN_EMMALLOC_ALIGN 8 |
| 86 | if (try_alignment < MIN_EMMALLOC_ALIGN) { |
| 87 | try_alignment = MIN_EMMALLOC_ALIGN; |
| 88 | } |
| 89 | *addr = emmalloc_memalign(try_alignment, size); |
| 90 | return (*addr != NULL ? 0 : ENOMEM); |
| 91 | } |
| 92 | |
| 93 | |
| 94 | //--------------------------------------------- |
nothing calls this directly
no test coverage detected