Increasing usage of RAM memory

Discussions related to the 1.36.x series of ZoneMinder
mendozaLt
Posts: 20
Joined: Wed Jul 13, 2022 3:05 pm

Re: Increasing usage of RAM memory

Post by mendozaLt »

I had to say it :cry:

Recent update, and i am having this:
image_2022-11-20_185933968.png
image_2022-11-20_185933968.png (30.2 KiB) Viewed 4941 times
image_2022-11-20_190107486.png
image_2022-11-20_190107486.png (26.6 KiB) Viewed 4941 times
:cry: :cry: :( :(
mendozaLt
Posts: 20
Joined: Wed Jul 13, 2022 3:05 pm

Re: Increasing usage of RAM memory

Post by mendozaLt »

And it takes 6 minutes after restart to go back to 98% used memory...
image_2022-11-20_190910707.png
image_2022-11-20_190910707.png (9.52 KiB) Viewed 4941 times
image_2022-11-20_191337368.png
image_2022-11-20_191337368.png (23.63 KiB) Viewed 4941 times
mendozaLt
Posts: 20
Joined: Wed Jul 13, 2022 3:05 pm

Re: Increasing usage of RAM memory

Post by mendozaLt »

Lamer wrote: Sun Oct 23, 2022 1:10 pm
mendozaLt wrote: Mon Oct 03, 2022 2:52 pm Been waiting for a solution for long time :( ... but for now i just had to stop zoneminder, as i cant use it normally...
Have you tried to set "Maximum Image Buffer Size (frames)" to some value instead of 0? Actually the meaning and effect of this parameter is not quite clear to me, but setting this to 1000 (for exampe) may solve the problem. Anyway in "Buffers" menu you'll get the definite max "Estimated Ram Use" instead of "Unlimited".
I tried, this is after setting it to 500 (remember, server has 56 Gb in total, and ZoneMinder takes 43 of it...):
image_2022-12-05_172921050.png
image_2022-12-05_172921050.png (6.87 KiB) Viewed 4868 times
image_2022-12-05_172947816.png
image_2022-12-05_172947816.png (19.29 KiB) Viewed 4868 times
User avatar
iconnor
Posts: 3391
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Increasing usage of RAM memory

Post by iconnor »

MaxImageBuffer should be roughly 2*keyframe interval. It should only be larger to deal with slow writing to disk or other temporary slowdown. So 500 is likely too high unless your stream is h264+ (very high keyframe interval).

If it is set too low, ZM will drop packets and complain.
mendozaLt
Posts: 20
Joined: Wed Jul 13, 2022 3:05 pm

Re: Increasing usage of RAM memory

Post by mendozaLt »

I see... how can i know what keyframe interval is? I don't know much about it, but Isn't it like 2 or something? :roll:
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Increasing usage of RAM memory

Post by Magic919 »

Might be in your camera settings menu.
-
mendozaLt
Posts: 20
Joined: Wed Jul 13, 2022 3:05 pm

Re: Increasing usage of RAM memory

Post by mendozaLt »

I set it to 50, for all cameras, that does not give any positive result...
image_2022-12-06_062804773.png
image_2022-12-06_062804773.png (14.28 KiB) Viewed 4826 times
JasonBorn
Posts: 39
Joined: Fri Jan 08, 2021 5:31 pm

Re: Increasing usage of RAM memory

Post by JasonBorn »

mendozaLt wrote: Tue Dec 06, 2022 5:28 am I set it to 50, for all cameras, that does not give any positive result...

image_2022-12-06_062804773.png
did you find a solution?
zmaximz
Posts: 36
Joined: Mon Sep 03, 2018 12:27 pm

Re: Increasing usage of RAM memory

Post by zmaximz »

Can anyone explain how it is possible? Why do I have duplicated monitors 69 using 8Gb of memory in S sleep state? It's just simple monitor with motion detection 12fps 4k. Recently I have low memory problems, sometimes, maybe after update, I'm not sure. Can't see any noticeable errors I will increase log.
Or maybe I should try 37 version...
Or it's just normal?, I added 16gb, who knows, maybe it will help. So memory hungry)
Screenshot 2025-05-29 012456.jpg
Screenshot 2025-05-29 012456.jpg (390.15 KiB) Viewed 1358 times
Screenshot 2025-05-29 015038.png
Screenshot 2025-05-29 015038.png (17.88 KiB) Viewed 1355 times
aarons6
Posts: 49
Joined: Mon Feb 08, 2016 12:13 pm

Re: Increasing usage of RAM memory

Post by aarons6 »

i am def getting high memory usage.. it could just the cpu cant keep up with the frames so it just keeps adding buffer until it runs out of ram and then the zmc crashes and starts over.

i set cron timer to reboot zm every few hours and it keeps the memory usage lower. if you let it run continuously it will eventually fill up the swap file and crash the server.

my pc is a 3900x with 80gb of ram and 10 IP cameras, most of 5MP but a few are 8MP.
most of the camera buffers are set to 4gb a couple of the 4k ones i had to go higher to keep the warnings about the buffer being too small.

the pc is averaging around 40-60gb used ram.
User avatar
swolsen
Posts: 35
Joined: Sat Mar 20, 2021 9:39 pm
Location: Schenectady, NY, USA

Re: Increasing usage of RAM memory

Post by swolsen »

Not sure if this will help. I created a cron job that watches the memory zmc uses and restarts zoneminder if it passes the setpoint I determine. Of course you will need to tweek it for your system. I placed this under the cron.houly folder in etc.


#!/bin/bash
lf="/var/log/restartzm.log"
tmp1="$(ps -C zmc -o pid,comm,pmem)"
echo -e "$(date '+%Y-%m-%d %H:%M:%S')\n $tmp1" >> $lf

zmch=$(echo "$tmp1" | awk /zmc/'{if (max == "") max=$3 ; else if ($3 > max) max=$3}END{printf "%d", max}')

setpoint=30

if [ $zmch -gt $setpoint ]; then
echo -e "$(date '+%Y-%m-%d %H:%M:%S') - $zmch is greater than the setpoint of $setpoint" >> $lf
echo "Restarting Zoneminder" >> $lf
/usr/bin/systemctl restart zoneminder
else
echo -e "$(date '+%Y-%m-%d %H:%M:%S') - $zmch is not greater than the setpoint of $setpoint" >> $lf
fi
Post Reply