3 ms·
madvise(MADV_FREE) (on *BSD) or madvise(MADV_DONTNEED) (on Linux) will remap the specified memory range to the zero page or leave it intact at the kernel’s disc
by mananaysiempre 2y ago
madvise(MADV_FREE) (on *BSD) or madvise(MADV_DONTNEED) (on Linux) will remap the specified memory range to the zero page or leave it intact at the kernel’s discretion.
- account42 2y agoCongratulations, you have reinvented realloc and are no longer using simple static arrays.
- mananaysiempre 2y agoUnlike realloc, though, I’m keeping element addresses stable. (I’m actually somewhat conflicted about TFA’s idea, for what it’s worth, I just don’t think freeing memory is the most problematic part of it.)