Open FeldrinH opened 1 year ago
I think this could be done behind a cfg
/feature
Yes that would be nice to have. For example in a scripting language used in a game, one would like to run the garbage collection in between frames (e.g., after the frame has been rendered and sent to the display). How big of a change would that feature be?
I don't think it would be that big. We already have a force_collect()
function exposed. We can expose a second maybe_collect()
that applies the threshold, and then have a way to disable the one place that collection is called automatically.
Currently it seems that GC can trigger a collection any time a new Gc is allocated. I would like to have manual control over when collection can happen. (I mean I want to prevent automatic collections during allocation from happening and instead manually call a function that checks the threshold and collects if there is too much allocated memory.)