-
Notifications
You must be signed in to change notification settings - Fork 50
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
Create a C API posix-compatible malloc/free wrapper crate #9
Comments
I believe that not only There is some API mismatch, Rust allocators takes |
Yeah. An easy, expedient solution would be to have the posix crate allocate An alternative, probably-better solution would be to tighten up the size classes' free list invariant to say that allocations from these lists must be exactly the size class's size. Right now, because we don't ensure that the blocks that populate a size class's free list are a multiple of the size class, and we never split a cell smaller than the size class's size, so the last cell from a block can have some remainder bloat size within it. If we fixed this and tightened the invariant, then we could just look at the cell's header's size to determine which free list to put it back in, and would not need to store any extra data. |
Summary
Add a C API crate that wraps
wee_alloc
and provides posixmalloc
andfree
.Motivation
C and C++ projects targeting wasm could benefit from
wee_alloc
too, and more users = more bug reports and reliability work and all that good stuff.Details
New crate at the top level of the repo, depending on
wee_alloc
Wraps a
wee_alloc
global allocator and exposesmalloc
andfree
(and I thinkrealloc
is part of the posix spec too?)The text was updated successfully, but these errors were encountered: