heap_bytes
fn heap_bytes() -> int Import
Source: use gc::{heap_bytes}; compiler/src/builtin_docs/gc.hy Returns the size of the managed heap in bytes.
This counts only memory the VM’s garbage collector manages: not native libraries, stacks or other process memory.
Returns#
int
Examples#
use gc::{heap_bytes};
use tests::assert;
let v = Vec::from([1, 2, 3]);
assert!(heap_bytes() > 0 && v.len() == 3);
See also#
root: Pinsvalueso the garbage collector keeps it alive while the returnedRootis reachable.get: Returns the pinned value, leaving the pin in place.unroot: Releases the pin and returns the value it held.weak: Makes a handle tovaluethat does not keep it alive.upgrade: Returns the value while it is still alive,Noneonce it was collected.collect: Runs a full garbage collection now and returns the number of bytes freed.