4. Release physical memory for cached large buffers immediately
通俗解读
对于缓存大于 64 KB 大缓冲区的自定义分配器应用,应保留已预留的虚拟地址范围,但在缓冲区返回缓存时立即调用 madvise,以释放物理内存。
- 在等待驱逐计时器期间保留已写入的缓存缓冲区会浪费数兆字节的物理内存。
- 当缓冲区返回缓存时,立即调用 madvise(..., MADV_DONTNEED) 或 madvise(..., MADV_FREE)。
- 保留虚拟地址范围;操作系统会立即回收物理内存,且该地址无需重新分配即可立即复用。
官方原文摘录
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 …
阅读官方全文 ↗ 在 StoreRules 规则库中打开 询问你的应用是否合规
变更历史
自 StoreRules 开始跟踪以来没有实质性变化。
开发者关于此条款的案例
暂无案例。