trimNativeHeap function

bool trimNativeHeap()

Ask the C allocator to return free pages to the OS, and report whether it released anything. Unsupported allocators return false.

Churning QuickJS engines (dispose, JavascriptRuntime.reinitialize) frees thousands of small blocks whose pages the allocator keeps for reuse, so process RSS stays high while the live heap is tiny. This is the lever for giving those pages back; see doc/wiki/guides/soak-rss-analysis.md.

Implementation

bool trimNativeHeap() => _jsTrimNativeHeap() != 0;