High RAM usage with motion detect

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
telepathicwalrus
Posts: 2
Joined: Wed Jan 26, 2022 11:13 am

High RAM usage with motion detect

Post by telepathicwalrus »

Hi, when my monitors detect events the ram usage of ZMC for that monitor increases and will eventually consume all the ram in the system. if the event stops being detected then it will stop the RAM usage going any higher until another event is detected. Is there something I am doing wrong? my details are below:

Zoneminder 1.36.12 running in VM on ubuntu 20.04
8 vcpu (host is xeon e5-2667v4)
24GB RAM

cameras are 4K 15fps with keyframe interval of 15 frames (1 second).

Thanks in advance
User avatar
iconnor
Posts: 1906
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: High RAM usage with motion detect

Post by iconnor »

I suspect one of two things:

You are encoding: encoding buffers a lot of frames in ram before outputting. at 4k , that is a ton of ram.
If pasthrough: It takes time to start up an event and write out frames, during which we are not clearing the queue. SO the queue fills up with captured packets. I am working on something to fix this in 1.37 which will get back ported to 1.36.13 when I feel it is good. The idea is to spawn another thread to do the event writing while we go back to analysing/clearing queue.

At the end of the day, 4k requires a ton of ram. My h265 4k cam that I have no control over the keyframe interval of uses 16Gb of ram.
telepathicwalrus
Posts: 2
Joined: Wed Jan 26, 2022 11:13 am

Re: High RAM usage with motion detect

Post by telepathicwalrus »

Hi, thanks for replying :D. I am using h264 passthrough so seems like the the second thing is happening. Would this cause the ram to increase and stay increased, even after the event has finished? As the event progresses the RAM usage increases until the event ends then it will stay at that level. If another event is created then ZMC wont increase its ram until the event is longer than the previous one. I guess using a substream for analysis would be better thank 4k.
handswork
Posts: 5
Joined: Sat Oct 31, 2020 4:16 pm

Re: High RAM usage with motion detect

Post by handswork »

I have similar issues.
Nothing when I was running 1.34.x first I believed it was because I upgraded to 1.36.x - but after a clean install of OS etc. still same issue
I’m running Ubuntu 20.04
16 cores and 50 GB RAM
OS/database is on NVMe and datastore on RAID10 HW controlled.
Only 3 cameras at 15 - 25 fps. 1080 - 2K passthrough

During “big” events zmc crashes and starts up again, but that means I only get half events recorded and missing valuable footage.
I have tried fine tuning all kinds of thing, back and forward, but no luck.

No high CPU or RAM when running 1.34.x even though my datastore was 20 TB, now I’m only using a 4 TB datastore…
User avatar
iconnor
Posts: 1906
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: High RAM usage with motion detect

Post by iconnor »

Well.. then we need debug level 4 logs.
PJ`
Posts: 1
Joined: Sun Mar 20, 2022 5:44 pm

Re: High RAM usage with motion detect

Post by PJ` »

I yesterday have the same issue, i`v got CT with 1.34 whats works fine. Then i updated to 1.36 it`s start to use much more memory writes in log about buffer size. I use rtsp passthrough camera settings.
sideband
Posts: 16
Joined: Sat Oct 24, 2020 2:19 pm

Re: High RAM usage with motion detect

Post by sideband »

Same issue. Ubuntu 20.04 in a ProxMox VM.

At first I thought it was ProxMox doing strange things, but then I ran across this thread.

The really strange thing is that, since upgrading from 1.34, /dev/shm is almost untouched.

I've considered trying to build under FreeBSD to see if the behavior is different, but, judging from the varying platforms mentioned in this thread it may not make a difference.
dougmccrary
Posts: 538
Joined: Sat Aug 31, 2019 7:35 am

Re: High RAM usage with motion detect

Post by dougmccrary »

The really strange thing is that, since upgrading from 1.34, /dev/shm is almost untouched.
Lest you worry about it, that is by design. Major rework between 1.34 -> 1.36
Post Reply