-
Notifications
You must be signed in to change notification settings - Fork 12
Introduce qimalloc as an allocator option #49
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
Conversation
|
The C version of dumb The good news: dumb |
68a91af to
f6cdb4e
Compare
|
Changed this to use the new crate: https://github.com/wasmx/qimalloc |
|
Looks good to me, can't approve my own PR though :) |
| #[macro_use] | ||
| extern crate cfg_if; | ||
|
|
||
| cfg_if! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pretty sure we don't need the cfg_if dependency here. We can do something like #[cfg(feature = "wee_alloc")] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also has/needs that #[global_allocator] annotation. Will that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, attributes apply to the item below. If the item is not compiled in, then the attribute isn't either.
d1e4114 to
7557f21
Compare
jakelang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good enough. We'll re-address the cfg-if question later.
|
Released qimalloc so we can refer to a version and not just a random repo in this crate. |
Closes #46.
So far it's a really dumb allocator. It simply tries to allocate enough wasm pages everytime the
allocmethod is called (i.e. pages are not filled with subsequent alloc calls). It also doesn't dealloc. I tested it withrunevm+heraand it passes some tests.