summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorNiklas Hambüchen <mail@nh2.me>2019-10-29 12:54:10 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-11-01 23:12:17 -0400
commit9980fb58f613ee3363c7e4cb86453e542c6c69aa (patch)
tree67f0e195dd71510d1d797ce5e07f422401269b90 /docs
parent01006bc79582616c9bbc842b397e85437a57ac18 (diff)
downloadhaskell-9980fb58f613ee3363c7e4cb86453e542c6c69aa.tar.gz
Add +RTS --disable-delayed-os-memory-return. Fixes #17411.
Sets `MiscFlags.disableDelayedOsMemoryReturn`. See the added `Note [MADV_FREE and MADV_DONTNEED]` for details.
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/runtime_control.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/users_guide/runtime_control.rst b/docs/users_guide/runtime_control.rst
index 96b3d8aba3..7ebb9eb207 100644
--- a/docs/users_guide/runtime_control.rst
+++ b/docs/users_guide/runtime_control.rst
@@ -241,6 +241,28 @@ Miscellaneous RTS options
crashes if exception handling are enabled. In order to get more information
in compiled executables, C code or DLLs symbols need to be available.
+.. rts-flag:: --disable-delayed-os-memory-return
+
+ If given, uses ``MADV_DONTNEED`` instead of ``MADV_FREE`` on platforms where
+ this results in more accurate resident memory usage of the program as shown
+ in memory usage reporting tools (e.g. the ``RSS`` column in ``top`` and ``htop``).
+
+ Using this is expected to make the program slightly slower.
+
+ On Linux, MADV_FREE is newer and faster because it can avoid zeroing
+ pages if they are re-used by the process later (see ``man 2 madvise``),
+ but for the trade-off that memory inspection tools like ``top`` will
+ not immediately reflect the freeing in their display of resident memory
+ (RSS column): Only under memory pressure will Linux actually remove
+ the freed pages from the process and update its RSS statistics.
+ Until then, the pages show up as ``LazyFree`` in ``/proc/PID/smaps``
+ (see ``man 5 proc``).
+
+ The delayed RSS update can confuse programmers debugging memory issues,
+ production memory monitoring tools, and end users who may complain about
+ undue memory usage shown in reporting tools, so with this flag it can
+ be turned off.
+
.. rts-flag:: -xp