Skip to main content

ManagedHeap

Struct ManagedHeap 

Source
pub struct ManagedHeap<T>
where T: ManagedObject,
{ /* private fields */ }
Expand description

Shared heap wrapper and its explicit tracing-or-retain policy. A dependency-correct managed heap composed from an arena and reclamation policy.

The wrapper is generic over the guest payload and lives beside the collector, so guest runtimes do not need to duplicate policy or lifecycle behavior.

Implementations§

Source§

impl<T> ManagedHeap<T>
where T: ManagedObject,

Source

pub fn tracing( cap: usize, limits: CollectionLimits, ) -> Result<ManagedHeap<T>, ArenaError>

Creates a heap which uses bounded tracing collection.

Source

pub fn retaining(cap: usize) -> Result<ManagedHeap<T>, ArenaError>

Creates a heap which retains objects until explicit teardown.

Source

pub fn allocate(&mut self, value: T) -> Result<ManagedHandle, ArenaError>

Allocates a value after checking the arena capacity and identity space.

Source

pub fn get(&self, handle: ManagedHandle) -> Result<&T, ArenaError>

Returns a shared value reference after validating its handle.

Source

pub fn get_mut(&mut self, handle: ManagedHandle) -> Result<&mut T, ArenaError>

Returns a mutable value reference after validating its handle.

Source

pub fn root( &mut self, handle: ManagedHandle, ) -> Result<RootedHandle, ArenaError>

Registers a validated handle as a tracing root.

Source

pub fn release_root( &mut self, rooted: RootedHandle, ) -> Result<ManagedHandle, ArenaError>

Releases one matching root registration.

Source

pub fn live_len(&self) -> usize

Returns the number of live managed allocations.

Source

pub const fn policy(&self) -> ManagedHeapPolicy

Returns the selected reclamation policy.

Source

pub const fn cycle_leak_gap(&self) -> Option<&'static str>

Describes the cycle-reclamation gap when retention is selected.

Source

pub fn collect(&mut self) -> Result<Option<CollectionReceipt>, CollectionError>

Runs the configured reclamation policy at a safepoint.

Retaining heaps return None without mutating the arena.

Source

pub fn teardown(&mut self) -> TeardownReceipt

Removes every object and root, returning deterministic teardown evidence.

Trait Implementations§

Source§

impl JavascriptHeapExt for ManagedHeap<ManagedNode<JavascriptManagedKind>>

Source§

fn connect( &mut self, from: ManagedHandle, to: ManagedHandle, ) -> Result<EdgeId, JavascriptManagedMutationError>

Adds a checked strong edge and returns its stable edge identity.
Source§

fn connect_weak( &mut self, from: ManagedHandle, to: ManagedHandle, ) -> Result<EdgeId, JavascriptManagedMutationError>

Adds a checked weak edge and returns its stable edge identity.
Source§

fn connect_ephemeron( &mut self, from: ManagedHandle, key: ManagedHandle, value: ManagedHandle, ) -> Result<EdgeId, JavascriptManagedMutationError>

Adds a checked ephemeron and returns its stable edge identity.
Source§

impl PythonHeapExt for ManagedHeap<ManagedNode<PythonManagedKind>>

Source§

fn connect( &mut self, from: ManagedHandle, to: ManagedHandle, ) -> Result<EdgeId, PythonManagedMutationError>

Adds a checked strong edge and returns its stable edge identity.
Source§

fn connect_weak( &mut self, from: ManagedHandle, to: ManagedHandle, ) -> Result<EdgeId, PythonManagedMutationError>

Adds a checked weak edge and returns its stable edge identity.
Source§

fn connect_ephemeron( &mut self, from: ManagedHandle, key: ManagedHandle, value: ManagedHandle, ) -> Result<EdgeId, PythonManagedMutationError>

Adds a checked ephemeron and returns its stable edge identity.

Auto Trait Implementations§

§

impl<T> Freeze for ManagedHeap<T>

§

impl<T> RefUnwindSafe for ManagedHeap<T>
where T: RefUnwindSafe,

§

impl<T> Send for ManagedHeap<T>
where T: Send,

§

impl<T> Sync for ManagedHeap<T>
where T: Sync,

§

impl<T> Unpin for ManagedHeap<T>

§

impl<T> UnsafeUnpin for ManagedHeap<T>

§

impl<T> UnwindSafe for ManagedHeap<T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> RealizationService for T
where T: Any + Send + Sync,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Returns a downcast hook for typed access.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,