Issue with Memory allocation failed error

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
andre1210
Posts: 12
Joined: Wed Oct 06, 2021 2:37 pm

Issue with Memory allocation failed error

Post by andre1210 »

Hi,
I'm using Zoneminder for several years with the same camera setup without issues.
This summer I upgraded from 1.34 to 1.36.5. After update I thought everything works fine, but now I ca see that some events have no end-time and in syslog I see often entries like

Nov 14 13:47:17 pi4b-2 zmc_m1[762]: FAT [zmc_m1] [Memory allocation failed: Cannot allocate memory]

Zoneminder is running on a Raspberry 4b 4GB
htop shows me a RAM usage of about 1GB
/dev/shm has a size of 1,7GB
the memomy mapped file in it is only 14MB small
df says tmpfs is used 1%
currently is only one camera 1280x960 h.264 active

Has anyone an idea for a rootcause?

thank you
André
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Issue with Memory allocation failed error

Post by bbunge »

andre1210 wrote: Sun Nov 14, 2021 1:01 pm Hi,
I'm using Zoneminder for several years with the same camera setup without issues.
This summer I upgraded from 1.34 to 1.36.5. After update I thought everything works fine, but now I ca see that some events have no end-time and in syslog I see often entries like

Nov 14 13:47:17 pi4b-2 zmc_m1[762]: FAT [zmc_m1] [Memory allocation failed: Cannot allocate memory]

Zoneminder is running on a Raspberry 4b 4GB
htop shows me a RAM usage of about 1GB
/dev/shm has a size of 1,7GB
the memomy mapped file in it is only 14MB small
df says tmpfs is used 1%
currently is only one camera 1280x960 h.264 active

Has anyone an idea for a rootcause?

thank you
André
Are you using Debian (Raspberry OS) or Ubuntu? 32 bit or 64 bit?
I have had some issues running Zoneminder on Pi 4B with Debian or Ubuntu. The Pi 3B+ works fine. I have not tried the new Bullseye on the Pi 4B yet. Mayne something to do on a rainy afternoon...
andre1210
Posts: 12
Joined: Wed Oct 06, 2021 2:37 pm

Re: Issue with Memory allocation failed error

Post by andre1210 »

Hi,
I‘m running Debian Buster 32 bit.
For my upgrade to 1.36 I did a fresh install.

I thought that many people are using zoneminder on a pi4b with Raspi OS and
there is only a bad config on my side.
Beetleboy
Posts: 13
Joined: Tue Feb 18, 2020 10:24 pm

Re: Issue with Memory allocation failed error

Post by Beetleboy »

I have been running 1.36.10 on both the Buster and more recently the Bullseye release of Rasberry Pi OS with no real issues, supporting 4 cameras. So we know it does work okay (I haven't fully checked out all functionality of Bullseye version yet).

One think I had to do was set the Maximum Image Buffer Size in the camera to 0. I can't recall what it was originally set when I upgraded, but occasionally I did run out of memory. With it set to zero so far I have had no issues, and it runs well. Check that and see if it helps
User avatar
iconnor
Posts: 2900
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Issue with Memory allocation failed error

Post by iconnor »

If you set MaxImageBuffer to 0, then if something bogs down, capture can consume all ram. So set it to something high, but that your system can handle.

I needs to be 2*+1 of the keyframe interval of your camera at least. Just like ImagebuffcountCount was before.

The idea now is that as long as all the processes are keeping up, we use less ram, but if any fall behind,..... how much ram can they consume?

Ii even added some nifty ram calculations to the monitor edit page relating to this. So that you could figure it out.

If your machine can't keep up, it is going to fall apart. not much I can do about that.
andre1210
Posts: 12
Joined: Wed Oct 06, 2021 2:37 pm

Re: Issue with Memory allocation failed error

Post by andre1210 »

Ok I began a new bullseye installation on my raspi today.
In the 1.36 repo for bullseye I can only find a 1.36.0 package for armhf.
On buster I‘m currently on 1.36.5
Is there a newer package for armhf and bullseye available?
Or can I use 1.36.0 and import my mysql export from 1.36.5?
Beetleboy
Posts: 13
Joined: Tue Feb 18, 2020 10:24 pm

Re: Issue with Memory allocation failed error

Post by Beetleboy »

I have been building my own packages the last little while, just recently built 1.36.10 for Bullseye on 32 bit Raspberry Pi OS. It’s pretty straightforward, following https://zoneminder.readthedocs.io/en/st ... index.html. I always specify the distro that I am building for. Do be aware that the build process will install a lot of other packages to complete the compile and package building. It helps if you are somewhat familiar with software building though. It takes about 10-15 minutes on Raspberry Pi 4 using an SSD as the hard drive. I would not try to build it using just a memory card.
andre1210
Posts: 12
Joined: Wed Oct 06, 2021 2:37 pm

Re: Issue with Memory allocation failed error

Post by andre1210 »

Now I build and installed 1.36.10 on bullseye.
Thank you for the information.
Unfortunately the situation is still the same.
50% of the events have no end time, the video is not complete and these messages in log:
2021-11-16 13:15:33 zmdc 3182 ERR 'zmc -m 1' exited abnormally, exit status 255 zmdc.pl -
2021-11-16 13:15:31 undef 16169 FAT Memory allocation failed: Cannot allocate memory zm_image.h
andre1210
Posts: 12
Joined: Wed Oct 06, 2021 2:37 pm

Re: Issue with Memory allocation failed error

Post by andre1210 »

I thing I found a solution
My camera sends 2 streams 960p and 720p.
I think with my 1.36 update I configured the wrong stream.
So ZM Monitor was configured for 960p and the used stream sent 720p.
I changed to 720p and now I get no error any more.
Maybe only an irritating error message.
Post Reply