You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and I think realloc is part of the posix spec too?
I believe that not only realloc but also calloc.
There is some API mismatch, Rust allocators takes Layout argument for alloc and dealloc, so, I guess on call to free before calling to dealloc we need to somehow obtain Layout for this particular allocation?
An easy, expedient solution would be to have the posix crate allocate n + 1 words and store the size just before the real allocation.
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: