MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / do_collection

Method do_collection

aiscript-arena/src/context.rs:268–275  ·  view source on GitHub ↗

Do some collection work until either the debt goes down below the target amount or we have finished the gc sweep phase. The unit of "work" here is a byte count of objects either turned black or freed, so to completely collect a heap with 1000 bytes of objects should take 1000 units of work, whatever percentage of them are live or not. In order for this to be safe, at the time of call no `Gc` poin

(
        &self,
        root: &R,
        target_debt: f64,
        early_stop: Option<EarlyStop>,
    )

Source from the content-addressed store, hash-verified

266 //
267 // If we are currently in `Phase::Sleep`, this will transition the collector to `Phase::Mark`.
268 pub(crate) unsafe fn do_collection<R: Collect + ?Sized>(
269 &self,
270 root: &R,
271 target_debt: f64,
272 early_stop: Option<EarlyStop>,
273 ) {
274 self.do_collection_inner(root, target_debt, early_stop)
275 }
276
277 fn do_collection_inner<R: Collect + ?Sized>(
278 &self,

Callers 5

collect_debtMethod · 0.80
mark_debtMethod · 0.80
collect_allMethod · 0.80
mark_allMethod · 0.80
start_sweepingMethod · 0.80

Calls 1

do_collection_innerMethod · 0.80

Tested by

no test coverage detected