rustwasm/wee_alloc

Runtime storage initialization

Open

#44 opened on May 24, 2018

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Rust (46 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (711 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Summary

I need an advice how properly implement runtime initialized storage.

Motivation

Now I use ugly hack to make wee_alloc work with my unikernel wrapper around solo5. In compile time i don't know anything about available heap address and size, I only can get it in runtime from specific structure.

So I add imp_ptr_array with specific alloc_pages implementation and call something like fn init(start: usize, size: usize), but that's very bad thing usable only for initial testing.

As i can see I need some trait or function which can change internal state of alloc_pages implementation

How does this further wee_alloc's goal of being the best allocator for wasm32-unknown-unknown, with a very small .wasm code size footprint?

It doesn't make wee_alloc any bigger in wasm code size, but makes it more usable as general purpose no_std allocator

Details

What bits of code would need to change? Which modules?

As I see it will be additional specific implementation similar to static_array without significant impact on other parts.

What are the trade offs?

Additional trait to be implemented on WeeAlloc structure

Are you willing to implement this yourself? If you had a mentor? Are you willing to mentor someone else?

I'm ready to implement it.

Contributor guide