-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A crate feature to implement the libc malloc API #9
Comments
An interesting idea! I think though you probably don't want to do this since it introduces two allocators, but rather you probably want to wrap |
I thought that this actually was the same allocator that Rust code would be using when compiling with wasm-bindgen. I see a bunch of Will it not work to add an explicit dependency on this crate (so that I can enable this feature)? |
It's true yeah that libstd uses dlmalloc, but if you depend on this crate from crates.io that pulls in two versions because you're not using the same version as libstd. By using |
Oh ok, thanks for the explanation; I didn't realize |
Great project!
What do you think about adding a feature flag that causes this crate to implement the libc malloc API (i.e.
extern "C"
malloc
,realloc
,calloc
,free
, and maybeposix_memalign
) for linked C/C++ code to consume?I have a mixed Rust/C project that I'm compiling to Wasm. I need a
malloc
implementation, because I'd like to usewasm32-unknown-unknown
and not Emscripten, so that I can usewasm-bindgen
. Also, to reduce the binary size, I'd like for my Rust and C code to share the same allocator.I've hacked this in locally, so if you're in favor of it, I'd be up for submitting a PR.
The text was updated successfully, but these errors were encountered: