>>100166221>"you have 1ms, do what you can without taking longer than that"Unless you're developing without kernel between you and the hardware that's highly improbable. Code can't know when it's being preempted, or when something is taking longer than it's supposed to; it can't really say "I can free these couple chunks, but if I take one more I'm over the threshold".
Which is yet another reason why arenas are so good - since you've decided what goes where you can also decide to delete it all by, let's say, resetting the end index back to the beginning.
>>100166235>Malloc/free are low levelLol no, they're not. NtAllocateVirtualMemory is low-level. mmap is low-level. Hugepages are low-level. malloc is generic slop without much granularity (except the allocation size). What is true is that they burden the user with responsibilities, but that's not because they're low-level, but because they're managing their own state so that they can avoid mode switches. With arenas you can implement a dirt-simple stack that doesn't need state other than the amount of memory already written, and as stated above setting that variable to 0 frees the arena without mode switch or locks.