From 459e9dc389ff573f76e0865a1eaa918018cc6d9a Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 19 Dec 2025 10:24:34 -0600 Subject: [PATCH] update memray docs --- docs/docs/troubleshooting/memory.md | 44 ++++++++++++++++------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/docs/docs/troubleshooting/memory.md b/docs/docs/troubleshooting/memory.md index b8ef5367d..ff8def83f 100644 --- a/docs/docs/troubleshooting/memory.md +++ b/docs/docs/troubleshooting/memory.md @@ -9,8 +9,20 @@ Frigate includes built-in memory profiling using [memray](https://bloomberg.gith Memory profiling is controlled via the `FRIGATE_MEMRAY_MODULES` environment variable. Set it to a comma-separated list of module names you want to profile: +```yaml +# docker-compose example +services: + frigate: + ... + environment: + - FRIGATE_MEMRAY_MODULES=frigate.embeddings,frigate.capture +``` + ```bash -export FRIGATE_MEMRAY_MODULES="frigate.review_segment_manager,frigate.capture" +# docker run example +docker run -e FRIGATE_MEMRAY_MODULES="frigate.embeddings" \ + ... + --name frigate ``` ### Module Names @@ -24,6 +36,7 @@ Frigate processes are named using a module-based naming scheme. Common module na - `frigate.output` - Output processing - `frigate.audio_manager` - Audio processing - `frigate.embeddings` - Embeddings processing +- `frigate.embeddings_manager` - Embeddings manager You can also specify the full process name (including camera-specific identifiers) if you want to profile a specific camera: @@ -55,11 +68,20 @@ After a process exits normally, you'll find HTML reports in `/config/memray_repo If a process crashes or you want to generate a report from an existing binary file, you can manually create the HTML report: +- Run `memray` inside the Frigate container: + ```bash -memray flamegraph /config/memray_reports/.bin +docker-compose exec frigate memray flamegraph /config/memray_reports/.bin +# or +docker exec -it memray flamegraph /config/memray_reports/.bin ``` -This will generate an HTML file that you can open in your browser. +- You can also copy the `.bin` file to the host and run `memray` locally if you have it installed: + +```bash +docker cp :/config/memray_reports/.bin /tmp/ +memray flamegraph /tmp/.bin +``` ## Understanding the Reports @@ -110,20 +132,4 @@ The interactive HTML reports allow you to: - Check that memray is properly installed (included by default in Frigate) - Verify the process actually started and ran (check process logs) -## Example Usage - -```bash -# Enable profiling for review and capture modules -export FRIGATE_MEMRAY_MODULES="frigate.review_segment_manager,frigate.capture" - -# Start Frigate -# ... let it run for a while ... - -# Check for reports -ls -lh /config/memray_reports/ - -# If a process crashed, manually generate report -memray flamegraph /config/memray_reports/frigate_capture_front_door.bin -``` - For more information about memray and interpreting reports, see the [official memray documentation](https://bloomberg.github.io/memray/).