Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Generational garbage collector #455

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

acondolu
Copy link
Contributor

@acondolu acondolu commented Feb 14, 2020

Context

The current asterius garbage collector is a copying collector, traversing all live heap objects whenever invoked. Performing a complete ("major") garbage collection each time is quite expensive, and usual runtime systems employ generational collectors, where objects in the heap are segregated according to their age; most times, only the youngest objects are garbage collected ("minor" collection).

Changes

This PR implements a simple generational GC, with two generations: gen 0 is the youngest and gen 1 the oldest. It requires inter-generational pointers (from gen 1 to gen 0) to be recorded, so to used them as roots during a minor collection. All young closures that survive a minor collection are promoted to gen 1 (i.e. generations are not divided in additional steps).

Special care has to be taken so to handle correctly "pinned" blocks: in the asterius runtime, the closures allocated in pinned blocks will not be moved by the garbage collector - this means that a different kind of promotion applies to pinned closures.

Related PRs

Work in progress

There is mainly one feature missing: deciding when the collector should select a minor vs major collection. Probably need to fine tune the parameters and verify reduced running times of tests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant