memory-control icon indicating copy to clipboard operation
memory-control copied to clipboard

The old memory mapping ringbuffer trick use-case

Open Daniel-Abrecht opened this issue 2 years ago • 0 comments

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.

Daniel-Abrecht avatar Jan 16 '23 10:01 Daniel-Abrecht