From 41d9577d7223fa32ff38fcc0adefb3fb108fda4c Mon Sep 17 00:00:00 2001
From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
Date: Mon, 12 Oct 2026 14:51:21 -0500
Subject: [PATCH] Fix docs shm calculator (#24649)
* match the docs shm calculator to the backend's minimum
The calculator left out the room Frigate reserves for 2 cameras added at runtime, counted the per-frame overhead once per camera instead of per frame, and reserved 40mb instead of 50mb for logs and the nginx cache, so a setup sized with it got well under 20 frames and the "SHM size is too small" warning. It now computes the same minimum as calculate_shm_requirements() and also shows the size for the full 50 frame cache.
* size the docs shm calculator for 25 frames
Sizing to the backend's 20 frame minimum could land at 19 frames from float rounding and still show the warning.
---
docs/docs/frigate/installation.md | 4 +-
docs/src/components/ShmCalculator/index.jsx | 79 +++++++++++++--------
2 files changed, 51 insertions(+), 32 deletions(-)
diff --git a/docs/docs/frigate/installation.md b/docs/docs/frigate/installation.md
index 14c85ec4f3..4c6ceec04d 100644
--- a/docs/docs/frigate/installation.md
+++ b/docs/docs/frigate/installation.md
@@ -78,9 +78,9 @@ Users of the Snapcraft build of Docker cannot use storage locations outside your
Frigate utilizes shared memory to store frames during processing. The default `shm-size` provided by Docker is **64MB**.
-The default shm size of **128MB** is fine for setups with **2 cameras** detecting at **720p**. If Frigate is exiting with "Bus error" messages, it is likely because you have too many high resolution cameras and you need to specify a higher shm size, using [`--shm-size`](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources) (or [`service.shm_size`](https://docs.docker.com/compose/compose-file/compose-file-v2/#shm_size) in Docker Compose). If raising the shm size does not help, check your [process and file limits](#process-and-file-limits) as well.
+Frigate needs about **210MB** for **2 cameras** detecting at **720p**. If Frigate is exiting with "Bus error" messages, it is likely because you have too many high resolution cameras and you need to specify a higher shm size, using [`--shm-size`](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources) (or [`service.shm_size`](https://docs.docker.com/compose/compose-file/compose-file-v2/#shm_size) in Docker Compose). If raising the shm size does not help, check your [process and file limits](#process-and-file-limits) as well.
-The Frigate container also stores logs in shm, which can take up to **40MB**, so make sure to take this into account in your math as well.
+The Frigate container also stores logs and an nginx cache in shm, which can take up to **50MB**. The calculator below includes this, along with room for 2 cameras added while Frigate is running. Its result holds about 25 frames per camera, a little above the 20 frame minimum Frigate warns below. Frigate keeps up to 50 when there is room, which gives slow processes more time to read each frame.
- Single Camera: {formatWithUnit(singleCameraShm)} + Per Camera: {formatWithUnit(singleCameraShm)}
- Formula: (width × height × 1.5 × 20 + 270480) ÷ - 1048576 + Formula: (width × height × 1.5 + 270480) ÷ + 1048576 × {TARGET_FRAMES} frames
- {cameraCount > 1 && ( -- Total ({cameraCount} cameras): {formatWithUnit(totalShm)} -
- )}- With Logs: + 40mb + Room for 2 Added Cameras:{" "} + {formatWithUnit(addedCamerasShm)} +
++ Logs and Cache: + {RESERVED_MB} + mb +
++ Birdseye Restream: + 8 + mb if enabled +
++ For {DEFAULT_FRAMES} Frames:{" "} + {formatWithUnit(fullRingShm)}