pub(crate) fn major_gc(&mut self) {
        let TypeGroup {
            related,
            ref mut free,
            ref mut gc_in_progress,
            ..
        } = self;

        related.iter().for_each(|ts| {
            // 0 is null.
            let state = unsafe { &mut *ts.state.get() };
            let arenas = unsafe { &mut *ts.arenas.get() };
            let relations = unsafe { &mut *ts.relations.get() };
            let pending = unsafe { &mut *ts.pending.get() };

            let invariant_id = ts.bump_invariant_id(pending);
            let mut collection =
                Collection::new(pending.epoch, &ts.type_info, relations, free, invariant_id);
            log::trace!("{:?}", collection);

            if let Some(Collection {
                condemned:
                    Arenas {
                        full,
                        partial,
                        worker,
                    },
                handler,
                ..
            }) = state
            {
                log::warn!("Collection already in progress");
                mem::swap(full, &mut collection.condemned.full);
                mem::swap(partial, &mut collection.condemned.partial);
                mem::swap(worker, &mut collection.condemned.worker);
                handler.drop();
            };

            log::trace!("marking: full {:?}", collection.condemned.full);
            collection
                .condemned
                .full
                .extend(arenas.full.drain().map(|(header, top)| {
                    unsafe { &mut *(header as *mut HeaderUnTyped) }.condemned = true;
                    (header, top)
                }));

            log::trace!("marking: partial {:?}", collection.condemned.partial);
            collection
                .condemned
                .partial
                .extend(arenas.partial.drain().map(|(header, (next, top))| {
                    let header = unsafe { &mut *(header as *mut HeaderUnTyped) };
                    header.condemned = true;
                    (header as _, (next, top))
                }));

            log::trace!("marking: worker {:?}", collection.condemned.worker);
            arenas.worker.iter_mut().for_each(|(h, (next, end))| {
                let header = unsafe { &mut *(*h as *mut HeaderUnTyped) };
                header.condemned = true;

                collection
                    .condemned
                    .worker
                    .entry(*h)
                    .and_modify(|(n, _)| {
                        *n = *next;
                    })
                    .or_insert((*next, *end));

                *end = *next;
            });

            *state = Some(collection);
        });

        *gc_in_progress = Some(Instant::now());
        log::warn!("Major GC started {:?}", self);
    }
/// Trigger the collection of all gc owned Arenas.
Trigger the collection of all gc owned Arenas.
Trigger the collection of all gc owned Arenas .
pub(crate) fn major_gc(&mut self) {
        let TypeGroup {
            related,
            ref mut free,
            ref mut gc_in_progress,
            ..
        } = self;
        related.iter().for_each(|ts| {
            // 0 is null.
            let state = unsafe { &mut *ts.state.get() };
            let arenas = unsafe { &mut *ts.arenas.get() };
            let relations = unsafe { &mut *ts.relations.get() };
            let pending = unsafe { &mut *ts.pending.get() };
            let invariant_id = ts.bump_invariant_id(pending);
            let mut collection =
                Collection::new(pending.epoch, &ts.type_info, relations, free, invariant_id);
            log::trace!("{:?}", collection);
            if let Some(Collection {
                condemned:
                    Arenas {
                        full,
                        partial,
                        worker,
                    },
                handler,
                ..
            }) = state
            {
                log::warn!("Collection already in progress");
                mem::swap(full, &mut collection.condemned.full);
                mem::swap(partial, &mut collection.condemned.partial);
                mem::swap(worker, &mut collection.condemned.worker);
                handler.drop();
            };
            log::trace!("marking: full {:?}", collection.condemned.full);
            collection
                .condemned
                .full
                .extend(arenas.full.drain().map(|(header, top)| {
                    unsafe { &mut *(header as *mut HeaderUnTyped) }.condemned = true;
                    (header, top)
                }));
            log::trace!("marking: partial {:?}", collection.condemned.partial);
            collection
                .condemned
                .partial
                .extend(arenas.partial.drain().map(|(header, (next, top))| {
                    let header = unsafe { &mut *(header as *mut HeaderUnTyped) };
                    header.condemned = true;
                    (header as _, (next, top))
                }));
            log::trace!("marking: worker {:?}", collection.condemned.worker);
            arenas.worker.iter_mut().for_each(|(h, (next, end))| {
                let header = unsafe { &mut *(*h as *mut HeaderUnTyped) };
                header.condemned = true;
                collection
                    .condemned
                    .worker
                    .entry(*h)
                    .and_modify(|(n, _)| {
                        *n = *next;
                    })
                    .or_insert((*next, *end));
                *end = *next;
            });
            *state = Some(collection);
        });
        *gc_in_progress = Some(Instant::now());
        log::warn!("Major GC started {:?}", self);
    }
pub ( crate ) fn major_gc ( & mut self ) { let TypeGroup { related , ref mut free , ref mut gc_in_progress , .. } = self ; related . iter ( ) . for_each ( | ts | { // 0 is null. let state = unsafe { & mut * ts . state . get ( ) } ; let arenas = unsafe { & mut * ts . arenas . get ( ) } ; let relations = unsafe { & mut * ts . relations . get ( ) } ; let pending = unsafe { & mut * ts . pending . get ( ) } ; let invariant_id = ts . bump_invariant_id ( pending ) ; let mut collection = Collection :: new ( pending . epoch , & ts . type_info , relations , free , invariant_id ) ; log :: trace ! ( " " collection ) ; if let Some ( Collection { condemned : Arenas { full , partial , worker , } , handler , .. } ) = state { log :: warn ! ( " " ) ; mem :: swap ( full , & mut collection . condemned . full ) ; mem :: swap ( partial , & mut collection . condemned . partial ) ; mem :: swap ( worker , & mut collection . condemned . worker ) ; handler . drop ( ) ; } ; log :: trace ! ( " " collection condemned full ) ; collection . condemned . full . extend ( arenas . full . drain ( ) . map ( | ( header , top ) | { unsafe { & mut * ( header as * mut HeaderUnTyped ) } . condemned = true ; ( header , top ) } ) ) ; log :: trace ! ( " " collection condemned partial ) ; collection . condemned . partial . extend ( arenas . partial . drain ( ) . map ( | ( header , ( next , top ) ) | { let header = unsafe { & mut * ( header as * mut HeaderUnTyped ) } ; header . condemned = true ; ( header as _ , ( next , top ) ) } ) ) ; log :: trace ! ( " " collection condemned worker ) ; arenas . worker . iter_mut ( ) . for_each ( | ( h , ( next , end ) ) | { let header = unsafe { & mut * ( * h as * mut HeaderUnTyped ) } ; header . condemned = true ; collection . condemned . worker . entry ( * h ) . and_modify ( | ( n , _ ) | { * n = * next ; } ) . or_insert ( ( * next , * end ) ) ; * end = * next ; } ) ; * state = Some ( collection ) ; } ) ; * gc_in_progress = Some ( Instant :: now ( ) ) ; log :: warn ! ( " " self ) ; }
Trigger the collection of all gc owned Arenas.
Trigger the collection of all gc owned Arenas .
&mut self
&mut self