Skip to content
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

WebAssembly support? #4

Closed
jedisct1 opened this issue Jun 22, 2019 · 4 comments
Closed

WebAssembly support? #4

jedisct1 opened this issue Jun 22, 2019 · 4 comments

Comments

@jedisct1
Copy link
Contributor

Is WebAssembly a target mimalloc may eventually support?

WebAssembly doesn't have mmap(); only a single, linear memory segment that can grow. Allocating memory from the host must be done in a way similar to sbrk(2) as in the good old days.

Is it something mimalloc could do?

@daanx
Copy link
Collaborator

daanx commented Jun 22, 2019

Yes, we want to see a WASM backend (especially since I am working towards supporting algebraic effects in WASM). I didn't study the full implications yet, but in principle it should be quite easy to extend mimalloc to use an sbrk like interface. The https://github.com/microsoft/mimalloc/blob/master/src/os.c source contains the OS interface but basically mimalloc just gets 4MiB chunks from the OS using whatever is available. Of course, some functionality would become noops, like guard pages or page resets, but that makes sense in a WASM environment.

@jedisct1
Copy link
Contributor Author

Preliminary port to WebAssembly/WASI here: https://github.com/jedisct1/mimalloc

@daanx
Copy link
Collaborator

daanx commented Jun 22, 2019

That is crazy fast! I'll look at it later when I have more time but this is great :-)

@daanx
Copy link
Collaborator

daanx commented Jun 25, 2019

I'll close this now that there is a pull request #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants