Trait jlrs::memory::gc::Gc

source ·
pub trait Gc: GcPriv {
    // Provided methods
    fn enable_gc(&self, on: bool) -> bool { ... }
    fn enable_gc_logging(&self, on: bool) { ... }
    fn gc_is_enabled(&self) -> bool { ... }
    fn gc_collect(&self, mode: GcCollection) { ... }
    fn gc_safepoint(&self) { ... }
    unsafe fn gc_safe_enter() -> i8 { ... }
    unsafe fn gc_safe_leave(state: i8) { ... }
    unsafe fn gc_unsafe_enter() -> i8 { ... }
    unsafe fn gc_unsafe_leave(state: i8) { ... }
    fn gc_set_max_memory(max_mem: u64) { ... }
}
Expand description

Manage the GC.

This trait provides several methods that can be used to enable or disable the GC, force a collection, insert a safepoint, and to enable and disable GC logging. It’s implemented for Julia and all Targets.

Provided Methods§

source

fn enable_gc(&self, on: bool) -> bool

Enable or disable the GC.

source

fn enable_gc_logging(&self, on: bool)

Enable or disable GC logging.

This method is not available when the lts feature is enabled.

source

fn gc_is_enabled(&self) -> bool

Returns true if the GC is enabled.

source

fn gc_collect(&self, mode: GcCollection)

Force a collection.

source

fn gc_safepoint(&self)

Insert a safepoint, a point where the garbage collector may run.

source

unsafe fn gc_safe_enter() -> i8

Put the current task in a GC-safe state.

In a GC-safe state a task must not be calling into Julia, it indicates that the GC is allowed to collect without waiting for the task to reach an explicit safepoint.

Safety:

While in a GC-safe state, you must not call into Julia in any way that. It should only be used in combination with blocking operations to allow the GC to collect while waiting for the blocking operation to complete.

You must leave the GC-safe state by calling Gc::gc_safe_leave with the state returned by this function.

source

unsafe fn gc_safe_leave(state: i8)

Leave a GC-safe region and return to the previous GC-state.

Safety:

Must be called with the state returned by a matching call to Gc::gc_safe_enter.

source

unsafe fn gc_unsafe_enter() -> i8

Put the current task in a GC-unsafe state.

In a GC-unsafe state a task must reach an explicit safepoint before the GC can collect.

Safety:

This function must only be called while the task is in a GC-safe state. After calling this function the task may call into Julia again.

You must leave the GC-safe state by calling Gc::gc_unsafe_leave with the state returned by this function.

source

unsafe fn gc_unsafe_leave(state: i8)

Leave a GC-unsafe region and return to the previous GC-state.

Safety:

Must be called with the state returned by a matching call to Gc::gc_unsafe_enter.

source

fn gc_set_max_memory(max_mem: u64)

Set GC memory trigger in bytes for greedy memory collecting

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Gc for Julia<'_>

source§

impl<'frame, T: Target<'frame>> Gc for T