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

View File

@@ -1,6 +1,14 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
// hide console window on Windows in release
#[cfg(feature = "memory")]
use re_memory::AccountingAllocator;
#[cfg(feature = "memory")]
#[global_allocator]
static GLOBAL: AccountingAllocator<std::alloc::System> =
AccountingAllocator::new(std::alloc::System);
use notedeck::{DataPath, DataPathType, Notedeck};
use notedeck_chrome::{
setup::{generate_native_options, setup_chrome},
@@ -66,6 +74,9 @@ fn setup_logging(path: &DataPath) -> Option<WorkerGuard> {
#[cfg(not(target_arch = "wasm32"))]
#[tokio::main]
async fn main() {
#[cfg(feature = "memory")]
re_memory::accounting_allocator::set_tracking_callstacks(true);
let base_path = DataPath::default_base_or_cwd();
let path = DataPath::new(base_path.clone());