5 ms·
Turns out that mmap() is the memory allocator, nothing to do with files.
by spc476 2y ago
Turns out that mmap() is the memory allocator, nothing to do with files.
- throwway120385 2y agoI was going to point out that you can mmap() anonymous pages and use them directly as heap so this tracks.
- o11c 2y agoI did suspect that, but now the implication is that the memory allocator is not reusing memory even though it easily could. GLIBC used to have a fixed 128 KiB threshold, but since 2.25 (2017) it defaults to dynamically adjusting the threshold to prevent exactly this pattern of excess syscalls. A manual threshold disables this though! (This may be a microoptimization depending on how much real work you're doing between the syscalls, but there's also a good chance that it's easy to fix.)