debug: add memory debug window

enable with:

$ cargo build --release --features memory

and then click the memory widget on the chrome sidepanel

currently doesn't track C allocations... we should fix that

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-07-08 13:27:37 -07:00
parent 738b5e71da
commit f25735f89e
5 changed files with 288 additions and 7 deletions

150
Cargo.lock generated
View File

@@ -172,7 +172,7 @@ dependencies = [
"objc2-foundation 0.3.1",
"parking_lot",
"percent-encoding",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
"x11rb",
]
@@ -1358,7 +1358,7 @@ version = "0.31.1"
source = "git+https://github.com/damus-io/egui?rev=73a831ed43d3a8592611e2948b505add88d8aba2#73a831ed43d3a8592611e2948b505add88d8aba2"
dependencies = [
"bytemuck",
"emath",
"emath 0.31.1 (git+https://github.com/damus-io/egui?rev=73a831ed43d3a8592611e2948b505add88d8aba2)",
"serde",
]
@@ -1407,7 +1407,7 @@ dependencies = [
"ahash",
"backtrace",
"bitflags 2.9.1",
"emath",
"emath 0.31.1 (git+https://github.com/damus-io/egui?rev=73a831ed43d3a8592611e2948b505add88d8aba2)",
"epaint",
"log",
"nohash-hasher",
@@ -1533,6 +1533,12 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "emath"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e4cadcff7a5353ba72b7fea76bf2122b5ebdbc68e8155aa56dfdea90083fe1b"
[[package]]
name = "emath"
version = "0.31.1"
@@ -1622,6 +1628,15 @@ dependencies = [
"syn 2.0.103",
]
[[package]]
name = "env_filter"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
dependencies = [
"log",
]
[[package]]
name = "epaint"
version = "0.31.1"
@@ -1631,7 +1646,7 @@ dependencies = [
"ahash",
"bytemuck",
"ecolor",
"emath",
"emath 0.31.1 (git+https://github.com/damus-io/egui?rev=73a831ed43d3a8592611e2948b505add88d8aba2)",
"epaint_default_fonts",
"log",
"nohash-hasher",
@@ -2625,6 +2640,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.15"
@@ -2855,6 +2879,15 @@ version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "log-once"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d8a05e3879b317b1b6dbf353e5bba7062bedcc59815267bb23eaa0c576cebf0"
dependencies = [
"log",
]
[[package]]
name = "loop9"
version = "0.1.5"
@@ -2928,6 +2961,16 @@ dependencies = [
"autocfg",
]
[[package]]
name = "memory-stats"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c73f5c649995a115e1a0220b35e4df0a1294500477f97a91d0660fb5abeb574a"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "metal"
version = "0.31.0"
@@ -3275,6 +3318,7 @@ dependencies = [
"profiling",
"puffin",
"puffin_egui",
"re_memory",
"serde",
"serde_json",
"strum",
@@ -3386,6 +3430,15 @@ dependencies = [
"tracing",
]
[[package]]
name = "ntapi"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
dependencies = [
"winapi",
]
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
@@ -4426,6 +4479,60 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f"
[[package]]
name = "re_format"
version = "0.23.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2911aed8ef5b658871fc109072e056d77e8a8af9c438f9662ed5c88ac6850313"
dependencies = [
"num-traits",
]
[[package]]
name = "re_log"
version = "0.23.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1179e5409f57aebeedcea10d5cc4bea2bf5a9f237901501cb9a0e505ae06112f"
dependencies = [
"env_filter",
"log",
"log-once",
"parking_lot",
"tracing",
]
[[package]]
name = "re_memory"
version = "0.23.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ee6d1efd5f0478116ca816ee1689995c7878107fe0ee06b7aecee8cd454ce00"
dependencies = [
"ahash",
"backtrace",
"emath 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.14.0",
"memory-stats",
"nohash-hasher",
"once_cell",
"parking_lot",
"re_format",
"re_log",
"re_tracing",
"smallvec",
"sysinfo",
"wasm-bindgen",
"web-time 1.1.0",
]
[[package]]
name = "re_tracing"
version = "0.23.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41f4ddc0564f0ae8fbe75a5ade3c66c9ddecf51bfcdf6aa4fa8b9ccce695a8fc"
dependencies = [
"puffin",
]
[[package]]
name = "redox_syscall"
version = "0.4.1"
@@ -5252,6 +5359,20 @@ dependencies = [
"syn 2.0.103",
]
[[package]]
name = "sysinfo"
version = "0.30.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3"
dependencies = [
"cfg-if",
"core-foundation-sys",
"libc",
"ntapi",
"once_cell",
"windows 0.52.0",
]
[[package]]
name = "system-deps"
version = "6.2.2"
@@ -6351,7 +6472,7 @@ dependencies = [
"wasm-bindgen",
"web-sys",
"wgpu-types",
"windows",
"windows 0.58.0",
]
[[package]]
@@ -6409,6 +6530,16 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core 0.52.0",
"windows-targets 0.52.6",
]
[[package]]
name = "windows"
version = "0.58.0"
@@ -6419,6 +6550,15 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-core"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-core"
version = "0.58.0"