1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Salsa memo-table memory introspection (issue #529).
//!
//! Behind the `memory-introspection` Cargo feature — an explicit opt-in so
//! ordinary consumers (`brink-lsp`, `brink-ide`, `brink-web`/wasm) never pull
//! in salsa's `salsa_unstable` surface; only the editor-session memory
//! profiling harness (`brink-test-harness/src/bin/editor_session_bench.rs`,
//! #529) enables it. Its public surface is plain data — this module (like
//! [`crate::db`]) is one of the only places in this crate allowed to see a
//! salsa type; nothing salsa-shaped escapes it.
//!
//! `count` is the number of live memo entries for a query, or live instances
//! for a struct/input table. It is the primary growth signal this module
//! exists to surface: salsa's own LRU capacity (the scripting-substrate
//! spec's §8 follow-up, deliberately out of scope here) trims memo tables by
//! *count*, not by byte size. `metadata_bytes`/`fields_bytes`/`heap_bytes`
//! are real numbers salsa tracks regardless, but for any query whose output
//! is `Arc<T>`-wrapped (most of layer 2/3 — `symbol_index_query`,
//! `resolve_query`, `lir_query`, `story_data_query`, …) `fields_bytes` is
//! only the pointer's size: salsa cannot see inside an `Arc` without an
//! explicit `heap_size` estimator, and none of this crate's queries specify
//! one (a deliberate scope boundary — a wrong or stale hand-rolled estimator
//! would silently under-report and mislead the next reader more than an
//! honest `None`/pointer-sized number does). `heap_bytes` is therefore
//! always `None` today; wiring up `heap_size` for specific queries is a
//! natural follow-up once this pass's `count` data identifies which ones
//! are worth it.
use crateBrinkDatabase;
/// Whether an [`IngredientMemory`] row describes a salsa input/tracked
/// struct table, or a memoized query function's output table.
/// One row of a [`crate::ProjectDb::memory_snapshot`]: a single salsa
/// ingredient and its current footprint.
/// Snapshot every salsa ingredient's memory footprint, sorted by
/// `(kind, name)` for deterministic, greppable output — a query or struct
/// that has never been invoked/created simply has no row (salsa's
/// `memory_usage` only reports what actually has memo/instance data), so the
/// row set itself can grow across a session as more of the query graph gets
/// exercised for the first time.
pub