From 5eaea3638cb92ab3d718a9498b58a72f1ce48af2 Mon Sep 17 00:00:00 2001 From: "mgsloan@gmail.com" Date: Tue, 5 Nov 2024 16:02:27 -0700 Subject: [PATCH] Document use of heaptrack for memory profiling on Linux --- docs/src/development/linux.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/src/development/linux.md b/docs/src/development/linux.md index ab55782f57ea8..1d232b90d278e 100644 --- a/docs/src/development/linux.md +++ b/docs/src/development/linux.md @@ -111,6 +111,23 @@ To build & install the Flatpak package locally follow the steps below: 3. Run `script/flatpak/bundle-flatpak`. 4. Now the package has been installed and has a bundle available at `target/release/{app-id}.flatpak`. +## Memory profiling + +[`heaptrack`](https://github.com/KDE/heaptrack) is quite useful for diagnosing memory leaks. To install it: + +```sh +$ sudo apt install heaptrack heaptrack-gui +$ cargo install cargo-heaptrack +``` + +Then, to build and run Zed with the profiler attached: + +```sh +$ cargo heaptrack -b zed +``` + +The output will include a path to a `*.zst` file which can then be passed to `heaptrack_gui` for analysis. + ## Troubleshooting ### Can't compile Zed