AtomVM icon indicating copy to clipboard operation
AtomVM copied to clipboard

Make features of the garbage collector tunable.

Open fadushin opened this issue 3 years ago • 1 comments

The tunables include:

  • the minimum free space (in terms) to be allocated when garbage collecting (defaults to 16)
  • the free space shrink factor (defaults to 2), used to determine when to shrink the heap when too much free space is available.

Use spawn_opt to specify these tunables in the properties list.

Also added metrics to process_info to view:

  • the amount of available heap space (in terms) in the process heap
  • the number of GCs that have occurred (counter)
  • the number of GC shrinks that have occurred (counter)

These changes are backwards-compatible with the existing GC behavior.

Signed-off-by: Fred Dushin [email protected]

These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

fadushin avatar Sep 18 '22 15:09 fadushin

In some analysis from earlier in the year, we found that reducing or even eliminating the second GC to shrink the heap had a dramatic improvement in performance, on the order of a few orders of magnitude, without resulting in a dramatic change in the heap size. More tests should be performed, but making these parameters tunable should be useful in the field. Untouched, the behavior of the GC is the same as before.

fadushin avatar Sep 21 '22 01:09 fadushin