3 ms·
Memory management is fundamentally a cross-cutting concern, so modules don’t help, unless you introduce some hard barrier (like copying everything at boundaries
by kaba0 3y ago
Memory management is fundamentally a cross-cutting concern, so modules don’t help, unless you introduce some hard barrier (like copying everything at boundaries).
- flohofwoe 3y agoGenerational-indices also help to secure system boundaries. The memory is always owned and manipulated by a system, and the system only hands out generational-index-handles as "object references". Arguably that's even a good idea in memory safe languages, it avoids tricky borrow checker issues, and also prevents the outside world to directly manipulate objects. Everything happens under control of the system.
- anonymoushn 3y agoModules work if they can operate without allocating or are generic over allocators. I don't really get why people think it's normal for e.g. a websocket decoder to insist on calling read, write, epoll, and mmap, if the user just wants to encode and decode messages.
- mgaunard 3y agoThere is no maximum size for a websocket message, so unless you want to force a size ahead of time, you might need to allocate to resize your buffer. Or you could give the message in fragments to the user, but that immediately becomes a very inconvenient API.