code wiki / _hdl_build / nx_memvel.nx

nx_memvel.nx

buildroot/runtime/_hdl_build/nx_memvel.nx

22165 B395 linesdepth 7pulls 9 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_memvel.nx -- WHICH process is EATING memory, ranked by SUSTAINED growth (seq1365 / seq1376). WHY IT EXISTS: nx_resmon ranks by MAGNITUDE, so a stable 3 GB tenant outranks a 50 MB process doubling every minute and the real leaker hides. Measured 2026-07-30: swap 525->609 permil in 51 min (~2.03 GB, ~40 MB/min) while the worst_committed process grew ~1 MB. LAW: a census that reports a LEVEL cannot find a LEAK. ★★WHY IT IS N-SAMPLE (this organ's own v1 was WRONG -- seq1376): the FIRST version took ONE 5-second window and I published its top row as a unified root cause. The very next run of the same organ put a DIFFERENT process on top (3560 kB/s vs the previous winner's 1597) and demoted the old winner to #3. The top slot ROTATES. A one-shot ranking of a noisy signal is a coin flip dressed as a finding -- the exact ONE-WINDOW-IS-NOT-A-RATE defect (seq1340) committed by the author of that law, using the tool built to prevent it. Knowing a discipline is not obeying it, so the discipline is now STRUCTURAL: this organ CANNOT report a single-window ranking, because it no longer takes one. ★THE DECIDING COLUMN IS grew_in=k/N, NOT the rate. A real leak grows in EVERY window (k=N). A process that tops one window and vanishes from the next is NOISE, and now says so on its own line. Rate alone cannot distinguish them, which is precisely how v1 misled. Rule 15: top-k, pid-join and rate arithmetic imported from nx_ctxtop_lib / nx_procchurn_lib. Exit 0 = sampled; 3 = UNMEASURED (fail-closed). license_tier: ORIGINAL Read-only. No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_ctxtop_lib.nx nx_proc_ctl.nx nx_ioadmit_lib.nx nx_memvel.nx

imports: nx_ctxtop_lib.nxnx_proc_ctl.nxnx_ioadmit_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main rm_conf rm_field rm_slen ct_load_centi ioa_ncpu rm_field ↻ ct_admit_runq rm_lcat rm_lnum sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_munmap mv_scan mv_committed rm_field ↻ ct_find ct_topk_insert rm_sustained_count pc_rate mv_putname mv_getname mv_getname ↻

structs

none

consts

26const MV_MAXP: i64 = 2048
27const MV_TABLE_BYTES: i64 = 16384
28const MV_DIRBUF: i64 = 65536
29const MV_STATBUF: i64 = 4096
30const MV_TOPK: i64 = 8
31const MV_TOPK_BYTES: i64 = 128
32const MV_ROUNDS: i64 = 5
33const MV_WINDOW_MS: i64 = 1200
34const MV_US_PER_MS: i64 = 1000
35const MV_NAMEOFF: i64 = 6
36const MV_EXIT_UNMEASURED: i64 = 3
37const MV_EXIT_REFUSED: i64 = 4
38const MV_ADMIT_DEFAULT: i64 = 800
39const MV_CONFBUF: i64 = 4096
40const MV_STATBUF: i64 = 65536 // whole-file /proc/stat read, sized like BA_READCAP so it cannot short-read
41const MV_LOADBUF: i64 = 128
47const MV_STATUSLINE: i64 = 256

functions

51func mv_committed(sbuf: *u8, sn: i64) -> i64
called by 1: mv_scan calls 1: rm_field
60func mv_scan(pids: *i64, kbs: *i64, dbuf: *u8, path: *u8, sbuf: *u8) -> i64
called by 1: main calls 1: mv_committed
106func mv_getname(pid: i64, path: *u8, sbuf: *u8, out: *u8, cap: i64) -> i64
called by 2: mv_putnamemain
125func mv_putname(pid: i64, path: *u8, sbuf: *u8) -> i64
called by 1: main calls 1: mv_getname
133func main() -> i64