|
|
|
|
|
by vardump
4006 days ago
|
|
> Suddenly your memory allocation routine is a pointer addition, and you don't need garbage collection either. Deallocation is just as fast as well, it just happens in one block. That's one of the techniques I apply. I have also some other tricks with different trade-offs up in my sleeve. This is primitive garbage collection. Because compaction / sweeping phase is simply discard all, no marking phase is required. Sometimes you get a lot of interrupts in a sequence, and if the lower priority code didn't have a chance to clean up the arena, you lose data. Interrupts can also occur at any point, unless you disable them. But you can't keep them disabled for very long. Maybe long enough that you check IRQ handler is not currently running on another core. If not, swap an arena pointer IRQ routine uses, enable interrupts again and start to process the previously pointed arena buffer. > It requires a bit of care in the code using it to not grow memory in an unbounded fashion, but this isn't really hard once you get used to it. This. The babysitting code and care you need for this technique. |
|