Skip to content
Success

Changes

Summary

  1. This is a rebase of the following patch by @stedolan: (commit: c89bff1) (details)
Commit c89bff11ab944e868413f446e1444577e7f6cdbb by damien.doligez
This is a rebase of the following patch by @stedolan:

------

Major GC work accounting fixes (oxcaml#3618)

The goal is to make the amount of "work" done by the major GC in a cycle match
what the pacing logic expects:

  - Marking: work is the size of the reachable data
  - Sweeping: work is the size of the allocated data (reachable or not)

There are two fixes in this patch to make this closer to true:

  - Extra marking work done by caml_darken should count towards the total
  - Free blocks should not count for sweeping work

The former makes a noticeable difference on some weird programs, and a new test
(darkening_work.ml) is added to demonstrate this. (It fails on all prior
versions of OCaml, as far as I've tested). The latter doesn't really make much
difference in practice, as the amount of free blocks in in-use pools tends to
be low, but it makes the code closer to the theory.
(commit: c89bff1)
The file was modifiedruntime/major_gc.c (diff)
The file was modifiedruntime/domain.c (diff)
The file was addedtestsuite/tests/misc/darkening_work.reference
The file was modifiedruntime/shared_heap.c (diff)
The file was modifiedruntime/caml/domain_state.tbl (diff)
The file was addedtestsuite/tests/misc/darkening_work.ml