Closed jq-rs closed 3 years ago
mi_calloc is here: https://github.com/purpleprotocol/mimalloc_rust/blob/master/libmimalloc-sys/src/extended.rs#L17
In the same file and elsewhere you'll find many mi_aligned_alloc functions (search for aligned
) which are more powerful and less error prone than the posix_memalign replacement.
Thanks. The external malloc API in rustc assumes support for posix_memalign. I am not aware of is it easy to change it to something else.
Hm? I have a patch somewhere that does this, it's definitely possible.
Worth noting that overriding malloc statically only works well on non-apple unixes though.
That said it's probably reasonable to add mi_posix_memalign for others who are stuck figuring out how to override something.
Note that you shouldn't use the override feature of this crate, though. It shouldn't have been added since for the most part it just enables functionality of the cmake build that is designed for producing a DLL that overrides malloc when set in the env.
Great, thanks! A new minor version published to crates.io would be awesome after this extension.
Please add support for
so that this crate could be used with Rust compiler as an allocator replacement.