Skip to content

Profiling

Heaptrack is a heap memory profiler for Linux, which can also be instrumented to run on OSX.

Being Linux only, some steps are necessary to ensure heaptrack can be used on OSx.

Devcontainer is leveraged to have amaru run in a pre-configured linux environment. Then XQuartz is used to display graphics directly on OSx host.

First install XQuartz

brew install --cask xquartz

then run it open -a XQuartz and allow remote external connections in menu Settings/Security then restart.

Finally, from within XQuartz integrated terminal, run xhost +localhost. IMPORTANT this has to be done each time XQuartz is restarted.

VSCode natively supports devcontainer so simply reopen your workspace in devcontainer. You will then get access to a regular VSCode instance as if it was running from within the docker instance.

Terminal window
cargo build --profile profiling
heaptrack ./target/profiling/amaru $YOUR_OPTIONS
Terminal window
heaptrack_gui SNAPSHOT_FILE

Use Dev Container CLI to automate interactions with the docker image:

Terminal window
devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . cargo build --profile profiling
devcontainer exec --workspace-folder . heaptrack ./target/profiling/amaru