Does limiting old‑generation heap size with +hms prevent memory leaks in long‑running Elixir processes?
0 reputation · 09 Apr 2020, 22:47 UTC
The goal is to determine whether imposing a hard limit on the old‑generation heap size via the BEAM flag +hms reliably prevents the unbounded memory growth that characterizes leaks in long‑running Elixir processes. Such leaks often stem from large binaries, ETS tables, or global process dictionaries that survive minor collections and accumulate in the old generation.
Constraints include the necessity to restart the node to apply +hms, the global effect on all processes, and the risk that frequent old‑gen collections may degrade performance or merely hide the leak rather than eliminate it. It is also unclear how the flag interacts with leaks that involve resources not reclaimed by garbage collection, such as open file descriptors or native resources.
Does the +hms flag actually stop old‑generation heap growth when the leak resides in binary data that is not subject to GC? If the flag triggers premature old‑gen collections, does it merely mask the leak or reduce observable memory growth without fixing the root cause?