Latest version appears to have a memory leak?

Current Development version likely to have breaking changes
Post Reply
jubishop
Posts: 9
Joined: Mon May 13, 2024 3:44 pm

Latest version appears to have a memory leak?

Post by jubishop »

Memory slowly climbs and I have to have a cronjob reboot the machine roughly every 12 hours. Is this a known issue?
dougmccrary
Posts: 1314
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Latest version appears to have a memory leak?

Post by dougmccrary »

Pretty much, yes. Unless it got much worse for you the last few builds. Been a problem since 1.34 - code name The Memory Remains
User avatar
iconnor
Posts: 3158
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Latest version appears to have a memory leak?

Post by iconnor »

There are no known memory leaks.

Every time I dig into one of these reports I find that the machine is under-spec'd and the user is ignoring their logs.

It is frustrating for everyone.

The most recent report, the user had a large pre-event-count. 150. Larger than the maximagebuffers count. So the poor machine was simultaneously trying to buffer 150 frames at 4k image resolution, and also trying to limit the buffer to something less than that. So now we have an error message when you try to create a situation like that.

What are you ImageBufferCount, MaxImageBufferCount and Pre_eventCounts set to? What is happening in your logs? What is the resolution of the camera? Are you recording all the time or just on motion?
jubishop
Posts: 9
Joined: Mon May 13, 2024 3:44 pm

Re: Latest version appears to have a memory leak?

Post by jubishop »

The logs are clean, nothing but INF.

I've tweaked the buffer counts many times to lock in a decent memory level, and it runs just fine for many hours, recording sometimes hundreds of events, but if I were to generate a graph of memory usage it'd climb slowly but inexorably. I don't see any reasonable explanation for that which wouldn't involve a leak. The memory usage starts out around 20%, hits 80% or so after 10 hours, and I just have it reset every 12 hours to keep it back under control.

I've got 5 cameras streaming at 1080p, my ImageBufferCount is 3, Max is 200, pre is 20. I've set the Max lower, it results in the memory starting out lower which buys me a bit more runway, however it still runs over eventually. I'm recording on motion.

I'm using a raspberry pi 5, 8gb.
jubishop
Posts: 9
Joined: Mon May 13, 2024 3:44 pm

Re: Latest version appears to have a memory leak?

Post by jubishop »

Side note: the error message about max needing to be more than pre seems to demand a 10x more. For example, if I want a pre of 20 I actually have to set the max to 200. I don't know why it's not just a simple > rather than >10x?
jubishop
Posts: 9
Joined: Mon May 13, 2024 3:44 pm

Re: Latest version appears to have a memory leak?

Post by jubishop »

screenshot of error at 190 over 20.
Screenshot 2024-05-16 at 9.03.51 AM.png
Screenshot 2024-05-16 at 9.03.51 AM.png (264.87 KiB) Viewed 2000 times
jubishop
Posts: 9
Joined: Mon May 13, 2024 3:44 pm

Re: Latest version appears to have a memory leak?

Post by jubishop »

getting ahead of a probable future question/concern: this is a freshly imaged raspberry pi with nothing else installed on it besides zoneminder, so I find it unlikely any other process is causing the gradual memory creep.

I just installed atop (the first non zoneminder related apt install :)), I can produce a report of memory usage over time once it's gathered data for a while.
dougmccrary
Posts: 1314
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Latest version appears to have a memory leak?

Post by dougmccrary »

Just a note - if you were running anything less than 1.37.60, what I said before was sorta true for me. But yesterday's .60 seems better. I'm about to get today's .60.
IgorA100
Posts: 143
Joined: Sat Feb 03, 2024 11:55 am

Re: Latest version appears to have a memory leak?

Post by IgorA100 »

iconnor wrote: Thu May 16, 2024 2:35 pm There are no known memory leaks.
On a couple of 3K-4K monitors sometimes a memory leak occurs (memory consumption increases X4 times). But this requires additional analysis on my part.
Post Reply