4. Release physical memory for cached large buffers immediately
In plain words
Apps with custom allocators that cache large buffers (> 64 KB) should keep the virtual address range reserved but call madvise immediately on return to the cache, so physical RAM is released.
- Holding dirty cached buffers while waiting for an eviction timer wastes megabytes of physical RAM.
- Call madvise(..., MADV_DONTNEED) or madvise(..., MADV_FREE) immediately when a buffer is returned to the cache.
- Keep the virtual address range reserved; the OS reclaims physical RAM right away and the address can be reused instantly without re-allocating.
From the official text
Custom allocators often cache large buffers ( 64 KB) in an in-memory pool so they can be reused without paying the overhead of mmap or munmap system calls. However, holding onto these dirty buffers in memory wastes megabytes of physical RAM while waiting for an eviction timer. What to do: Keep the virtual memory …
Read the full official text ↗ Open in the StoreRules library Ask whether your app complies
Change history
No substantive change since StoreRules began tracking it.
Developers' cases about this clause
No cases yet.