Skip to main content

MemoryUsage

Struct MemoryUsage 

Source
pub struct MemoryUsage {
Show 24 fields pub malloc_count: i64, pub malloc_size: i64, pub memory_used_count: i64, pub memory_used_size: i64, pub malloc_limit: i64, pub str_count: i64, pub str_size: i64, pub obj_count: i64, pub obj_size: i64, pub prop_count: i64, pub prop_size: i64, pub shape_count: i64, pub shape_size: i64, pub js_func_count: i64, pub js_func_size: i64, pub js_func_code_size: i64, pub js_func_pc2line_count: i64, pub js_func_pc2line_size: i64, pub c_func_count: i64, pub array_count: i64, pub fast_array_count: i64, pub fast_array_elements: i64, pub binary_object_count: i64, pub binary_object_size: i64,
}
Expand description

What one runtime occupies, in the reference’s JSMemoryUsage field names.

The names are the C header’s on purpose: quickjs-capi copies this into a JSMemoryUsage field for field, and a C program reading s->prop_count has to get the number this measured.

Fields§

§malloc_count: i64

Live heap blocks.

§malloc_size: i64

Bytes those blocks hold: headers plus payloads.

§memory_used_count: i64

The reference’s memory used count. Equal to MemoryUsage::malloc_count, and filled only so a C host reading the field gets an answer: the row is not printed, because the reference’s version is this number minus an allocator overhead this engine cannot see, and two rows with the same value under two names is noise.

§memory_used_size: i64

The reference’s memory used bytes. See MemoryUsage::memory_used_count.

§malloc_limit: i64

--memory-limit, or -1 when unlimited.

-1 rather than 0 because 0 is a legitimate limit meaning “no memory at all” — the reference’s field is a size_t initialised to -1 for exactly this reason (see docs/m15-plan.md’s note that JS_SetMemoryLimit(rt, 0) is not “cancel the limit”). Reinterpreting 0 as “unlimited” in the renderer would make the one limit that refuses every allocation print as no limit at all.

§str_count: i64

Strings.

§str_size: i64

Their bytes.

§obj_count: i64

Objects.

§obj_size: i64

Their bytes.

§prop_count: i64

Own properties, over all objects.

§prop_size: i64

Their slot bytes.

§shape_count: i64

Hidden classes. Always 0: see the module docs.

§shape_size: i64

Their bytes. Always 0.

§js_func_count: i64

Functions compiled from JavaScript.

§js_func_size: i64

Their allocations.

§js_func_code_size: i64

Instruction bytes.

§js_func_pc2line_count: i64

Functions carrying a pc-to-line table.

§js_func_pc2line_size: i64

Bytes of those tables.

§c_func_count: i64

Builtin and host functions.

§array_count: i64

Array objects.

§fast_array_count: i64

Arrays whose elements are a dense vector.

§fast_array_elements: i64

Elements in those.

§binary_object_count: i64

ArrayBuffer, TypedArray, DataView.

§binary_object_size: i64

Their bytes.

Trait Implementations§

Source§

impl Clone for MemoryUsage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MemoryUsage

Source§

impl Debug for MemoryUsage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryUsage

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for MemoryUsage

Source§

impl PartialEq for MemoryUsage

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MemoryUsage

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.