Skip to main content

MemoryReport

Struct MemoryReport 

Source
pub struct MemoryReport {
Show 38 fields pub vfs_files: usize, pub vfs_text_bytes: usize, pub vfs_line_index_bytes: usize, pub summaries: usize, pub summary_bytes: usize, pub cooked_files: usize, pub cooked_bytes: usize, pub definitions: usize, pub definition_bytes: usize, pub units: usize, pub unit_bytes: usize, pub renderings: usize, pub rendering_bytes: usize, pub views: usize, pub view_bytes: usize, pub dead_macro_decisions: usize, pub dead_macro_bytes: usize, pub directive_signatures: usize, pub include_searches: usize, pub units_read: usize, pub walk_cache_entries: usize, pub walk_cache_bytes: usize, pub walks_by_content_entries: usize, pub walks_by_content_bytes: usize, pub shared_timeline_bytes: usize, pub index_names_bytes: usize, pub index_name_postings: usize, pub index_scope_postings: usize, pub index_edges: usize, pub index_edge_bytes: usize, pub index_member_lists: usize, pub index_member_list_bytes: usize, pub index_memo_entries: usize, pub index_memo_bytes: usize, pub index_names_entries: usize, pub prefetched: usize, pub prefetched_bytes: usize, pub index_scope_entries: usize,
}
Expand description

The size of every table the session holds, as estimated bytes.

Fields§

§vfs_files: usize

Files the VFS is holding the text of.

§vfs_text_bytes: usize

The bytes of those texts.

§vfs_line_index_bytes: usize

The line indexes that go with them (an offset per line, plus a byte per line).

§summaries: usize

Summaries in the index, and their estimated bytes.

§summary_bytes: usize§cooked_files: usize

The cooked reading: how many files have one, and their estimated bytes.

§cooked_bytes: usize§definitions: usize

Entries in MacroDefinitions, and their estimated bytes.

§definition_bytes: usize§units: usize

Held translation units, and their estimated bytes.

§unit_bytes: usize§renderings: usize

The rendering cache: entry count and the bytes of rendered text.

§rendering_bytes: usize§views: usize

The parse trees kept for reuse: how many views, and their estimated tree bytes.

The newest table here and the largest per entry — a rowan tree is 8–24× the text it describes (docs/parser-review.md §2) — bounded by crate::cache::cache_lru::VIEW_BYTES of estimated tree. It buys a hundredfold on every request that asks a question about a position, which used to parse the rendering again.

§view_bytes: usize§dead_macro_decisions: usize

Dead-macro decisions, one vector of offsets per file.

§dead_macro_bytes: usize§directive_signatures: usize

Directive signatures, one per edited file.

§include_searches: usize

Include-search answers (bounded).

§units_read: usize

Unit keys this session has ever read.

§walk_cache_entries: usize

The process-wide contribution table: entries and estimated bytes.

§walk_cache_bytes: usize§walks_by_content_entries: usize

Timelines remembered by closure content — the dedup table, entries and estimated bytes.

Bounded in bytes (MAX_WALKS_BY_CONTENT_BYTES, 64 MB) rather than in entries: a timeline measures 0.1–6.2 MB, so a count would be a budget of anywhere between six megabytes and two gigabytes.

§walks_by_content_bytes: usize§shared_timeline_bytes: usize

The part of the two timeline tables that is one allocation, not two.

The unit table and the sharing cache hold the same Arc<TranslationUnit> whenever a timeline was both held for a root and remembered for its closure’s content, which is the common case — so adding MemoryReport::unit_bytes to MemoryReport::walks_by_content_bytes counts one allocation twice. This field is the overlap, measured by comparing the Arc pointers rather than assumed, and the totals below subtract it.

Measured on a 103-source project at twenty opened files: units 40.4 MB + walks 46.6 MB with every timeline in both, so the report said 87 MB where the process held 47.

§index_names_bytes: usize

The index’s own tables — what summary_bytes and cooked_bytes are about, rather than the facts.

The inverted index (names), the include graph, and the memos that outlive a request. None of it was in this report, and on a 103-source project the session said 112.4 MB while the process held 263 MB — a gap that had three candidate explanations and no way to tell them apart. See crate::index::project::ProjectIndex::table_accounting.

§index_name_postings: usize

Postings in the inverted index, under names and scopes — one per non-local declaration.

§index_scope_postings: usize

Postings under a scope.

§index_edges: usize

Include edges across the project.

§index_edge_bytes: usize

The include graph and the module map, in bytes.

§index_member_lists: usize

Member lists remembered, and the bytes of what they hold.

§index_member_list_bytes: usize§index_memo_entries: usize

Guard verdicts and conditional-include answers remembered.

§index_memo_bytes: usize§index_names_entries: usize

Distinct names in the inverted index.

§prefetched: usize

Distinct scopes in it. The slices prepared and not yet committed — [Session::prefetched].

A table the report did not name, and the only place a summary can be held without being in the index: commit_a_wave moves entries out as it commits them and clears the map when the queue empties, but a wave prepares up to four times the files it will commit. On test_cpp/src/containers.cpp the pump’s own tables reported 83–86 MB while the process grew to gigabytes and the work was finite (pending 26 → 10), so the bytes had to be somewhere the report did not look.

§prefetched_bytes: usize§index_scope_entries: usize

Implementations§

Source§

impl MemoryReport

Source

pub fn index_table_bytes(&self) -> usize

The index’s own tables, in bytes — the part of the report that is not a file’s facts.

Source

pub fn total(&self) -> usize

Everything the session’s own tables hold — the sum of the fields above, without the walk cache, which is process-wide rather than the session’s.

Counts a shared timeline once. unit_bytes and walks_by_content_bytes overlap by MemoryReport::shared_timeline_bytes; the walk table’s half is excluded here and the unit table’s half stays, so the sum is the bytes actually held.

Source

pub fn total_with_the_process(&self) -> usize

The same total including the tables that are not the session’s own — the process-wide contribution table.

Trait Implementations§

Source§

impl Clone for MemoryReport

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 MemoryReport

Source§

impl Debug for MemoryReport

Source§

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

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

impl Default for MemoryReport

Source§

fn default() -> Self

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

impl Display for MemoryReport

Source§

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

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

impl Eq for MemoryReport

Source§

impl PartialEq for MemoryReport

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 MemoryReport

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> 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> 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> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.