WebAssembly / memory-control

A proposal to introduce finer grained control of WebAssembly memory.
Other
21 stars 2 forks source link

The old memory mapping ringbuffer trick use-case #5

Open Daniel-Abrecht opened 1 year ago

Daniel-Abrecht commented 1 year ago

I would love multiple memories & memory mapping. But I'm unsure if this proposal could cover my use cases.

For example, in some of my programs, like in this library, I use memory mapping to make ring buffers: https://github.com/Daniel-Abrecht/ml666/blob/0d4111f7a47bbcfd84b8136526aa1510c02e820d/src/tokenizer.c#L133

Basically, I map 1 real page to 2 virtual pages next to each other, that way, there is always an offset in the first buffer, where I can read, and one where I can write, the whole used/free space continuously. I don't think this proposal would let me do that.

It' still better than nothing, though. I think I could still emulate APIs like sharing memory using files and/or unix sockets with this abstraction, with some limitations.