3 ms·
The bootstrap heap has a freelist that is just an array of entries that tell you where the free memory is. That array has to be allocated somewhere. All pas_s
by pizlonator 4y ago
The bootstrap heap has a freelist that is just an array of entries that tell you where the free memory is.
That array has to be allocated somewhere.
All pas_simple_large_free_heaps allocate that array from the bootstrap heap. Including the bootstrap heap. So, the pas_simple_large_free_heap has hacks that go something like: "if I'm allocating or freeing something and I need to allocate or free the free list, then very carefully also perform that allocation/deallocation in tandem with the one I'm doing". The main hack there is just that there's some statically allocated "slop" for the boostrap free list, so if you want to add to it in the middle of an allocation, you add it to the slop array, and then after you're doing you reallocate the free list and copy stuff from slop into it.
- mattgreenrocks 4y agoAhhhhhh, makes sense now. Thank you!