4. Release physical memory for cached large buffers immediately
わかりやすく
64 KBを超える大きなバッファをキャッシュするカスタムアロケータを使用するアプリは、仮想アドレス範囲を予約したままにし、バッファをキャッシュに戻した時点で直ちにmadviseを呼び出して物理RAMを解放すべきです。
- 解放タイマーの待機中にダーティなキャッシュバッファを保持すると、数MBの物理RAMが無駄になります。
- バッファをキャッシュに戻すときは、直ちに madvise(..., MADV_DONTNEED) または madvise(..., MADV_FREE) を呼び出してください。
- 仮想アドレス範囲は予約したままにしてください。OSは物理RAMをすぐに回収し、そのアドレスは再割り当てなしで即座に再利用できます。
公式テキストより
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 が追跡を始めてから実質的な変更はありません。
この条項に関する開発者の事例
まだ事例はありません。