Page 1 of 1

Latest version appears to have a memory leak?

Posted: Thu May 16, 2024 2:22 am
by jubishop
Memory slowly climbs and I have to have a cronjob reboot the machine roughly every 12 hours. Is this a known issue?

Re: Latest version appears to have a memory leak?

Posted: Thu May 16, 2024 4:34 am
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

Re: Latest version appears to have a memory leak?

Posted: Thu May 16, 2024 2:35 pm
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?

Re: Latest version appears to have a memory leak?

Posted: Thu May 16, 2024 4:01 pm
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.

Re: Latest version appears to have a memory leak?

Posted: Thu May 16, 2024 4:03 pm
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?

Re: Latest version appears to have a memory leak?

Posted: Thu May 16, 2024 4:04 pm
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 3636 times

Re: Latest version appears to have a memory leak?

Posted: Thu May 16, 2024 4:34 pm
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.

Re: Latest version appears to have a memory leak?

Posted: Thu May 16, 2024 9:54 pm
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.

Re: Latest version appears to have a memory leak?

Posted: Sat May 18, 2024 12:44 pm
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.