Re:A Fast, Growable Array with Stable Pointers in C
by vlovich123 on Wednesday August 06, 2025 @11:01PM
(#44820143)
Freeing memory to the OS or doing things like munmap involves a TLB shootdown which by definition is a performance bottleneck. Probably what you ended up experiencing.
Re:A Fast, Growable Array with Stable Pointers in C
by OptionOfT on Friday August 08, 2025 @10:56AM
(#44837771)
Thanks for that. That was an interesting read!
I ended up in this situation like I end up in most, by just learning as I go.
With this I learned that the libc allocator has a max amount that it'll add to the heap, and how mmap works, and that doing frequent munmap is slow.
Now I learned why it is slow!
The space I needed was too large to be added to the heap, so I used mmap. Because of the nature of the processing (mmap, process, yeet mmap) I put the system under a lot of pressure. Maintaining the set of mapped blocks and reusing them around fixed the issue.