pub struct Heap { /* private fields */ }Expand description
Owns the live-object registry for one JavaScript runtime.
Implementations§
Source§impl Heap
impl Heap
Sourcepub fn new() -> Heap
pub fn new() -> Heap
Create an empty heap. Runs the collector only when asked
(see Heap::set_threshold).
Sourcepub fn set_threshold(&self, n: usize)
pub fn set_threshold(&self, n: usize)
Trigger a collection automatically when more than n boxes are live.
usize::MAX disables automatic collection (the default).
Sourcepub fn live_count(&self) -> usize
pub fn live_count(&self) -> usize
Number of live boxes.
Sourcepub fn allocated_bytes(&self) -> usize
pub fn allocated_bytes(&self) -> usize
Approximate number of bytes held by live boxes (excluding external allocations made by the values themselves).
Sourcepub fn collect(&self) -> CollectStats
pub fn collect(&self) -> CollectStats
Run the cycle collector.
Objects that are only reachable from garbage are dropped and freed; everything reachable from a handle living outside the heap survives.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Heap
impl !RefUnwindSafe for Heap
impl !Send for Heap
impl !Sync for Heap
impl !UnwindSafe for Heap
impl Forget for Heap
impl Move for Heap
impl Unpin for Heap
impl UnsafeUnpin for Heapwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Option<NonNull<Header>>>: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more