From 21874f0a572316460f1bf7955d117aa66d688045 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 13 Jan 2023 18:17:43 +0100 Subject: [PATCH] add documentation about memory profiling on linux (#2776) --- docs/pages/pack/docs/advanced/profiling.mdx | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/pages/pack/docs/advanced/profiling.mdx b/docs/pages/pack/docs/advanced/profiling.mdx index 2de265009af0e..3fb4dc02035e3 100644 --- a/docs/pages/pack/docs/advanced/profiling.mdx +++ b/docs/pages/pack/docs/advanced/profiling.mdx @@ -1,5 +1,5 @@ --- -title: Profiling +title: Profiling description: Learn how to profile Turbopack --- @@ -51,6 +51,26 @@ Once the program exits, the profiler will open the trace file in Instruments. Re caption="An example trace from the time profiler." /> +## Linux + +### Memory usage + +``` sh +# Install `heaptrack` and `heaptrack_gui` +sudo apt install heaptrack heaptrack_gui + +# Compile with debug info but without the alternative allocator: +CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --bin next-dev --release --no-default-features --features cli + +# Run the binary with heaptrack (it will be much slower than usual) +heaptrack target/release/next-dev [...] + +# Stop it anytime + +# Open the GUI and open the heaptrack.next-dev.XXX.gz file +heaptrack_gui +``` + ## On other platforms We currently don't have a guide for profiling Turbopack on other platforms.