It uses /dev/shm under Linux and /tmp under FreeBSD. If /tmp is not backed by tmpfs, shared buffer will be on disk.Last time I looked at ZoneMinder, which was admittedly awhile ago, it had somewhat onerous requirements for memory especially for things like motion detection, as it used shared memory for some of this functionality.
Min Bits of Memory = 20% overhead * (image-width*image-height*image buffer size*target color space*number of cameras)
The math breakdown for 4 cameras running at 1280x960 capture, 50 frame buffer, 24 bit color space:
1280*960 = 1,228,800 (bytes)
1,228,800 * (3 bytes for 24 bit) = 3,686,400 (bytes)
3,686,400 * 50 = 184,320,000 (bytes)
184,320,000 * 4 = 737,280,000 (bytes)
737,280,000 / 1024 = 720,000 (Kilobytes)
720,000 / 1024 = 703.125 (Megabytes)
703.125 / 1024 = 0.686 (Gigabytes)
Around 700MB of memory.
So if you have 2GB of memory, you should be all set. Right? Not, really:
So a good rule of thumb is to make sure you have twice the memory as the calculation above (and if you are using the ZM server for other purposes, please factor in those memory requirements as well)
- This is just the base memory required to capture the streams. Remember ZM is always capturing streams irrespective of whether you are actually recording or not - to make sure its image ring buffer is there with pre images when an alarm kicks in.
- You also need to account for other processes not related to ZM running in your box
- You also need to account for other ZM processes - for example, I noticed the audit daemon takes up a good amount of memory when it runs, DB updates also take up memory
- If you are using H264 encoding, that buffers a lot of frames in memory as well.
Also remember by default ZM only uses 50% of your available memory unless you change it