4 ms·
> Tracking the memory here would slow you down. Meh. A lot of systems use specialized memory pools for such use cases: - allocate memory pages from OS - alloca
by _pmf_ 10y ago
> Tracking the memory here would slow you down.
Meh. A lot of systems use specialized memory pools for such use cases:
- allocate memory pages from OS
- allocate objects via this pool
- release the full pool when done (i.e. just unmap t page, which essentially has no cost at all)
If the task at hand is known to have an upper bound of same sized objects, this basically reduces management overhead to maintaining a single pointer (and you can work with guard pages to just catch the segfault when trying to access out-of-bound memory, which is not that far fetched because it is actually what some JIT'd Java code does to optimize out null checks [0]).
[0] http://jcdav.is/2015/10/06/SIGSEGV-as-control-flow/ http://jcdav.is/2015/10/06/SIGSEGV-as-control-flow/