Page 1 of 1

A memory leak located?

Posted: Sat Oct 07, 2023 5:47 pm
by pygr
Version 1.37.45

Before another memory allocation is made for

Code: Select all

packet->image
, is the old one deallocated in the method Monitor::Decode() in zm_monitor.cpp?

If I put

Code: Select all

delete packet->image;packet->image = nullptr;
near the end of Decode(), zoneminder seems to leak memory less badly. I haven't noticed any bad side effects.

I'm seeing other memory leaks, but I want to get a better handle on them before I post anything more here.

Re: A memory leak located?

Posted: Sun Oct 08, 2023 7:43 am
by Magic919
I’d suggest using Slack as that’s where the Developers hang out.

Re: A memory leak located?

Posted: Sun Oct 08, 2023 2:51 pm
by iconnor
I'm here. I'll take a look.

Re: A memory leak located?

Posted: Sun Oct 08, 2023 2:56 pm
by iconnor
If you delete the image, then we can't do analysis on it later....

The image is deleted when the packet is deleted.

Re: A memory leak located?

Posted: Sun Oct 08, 2023 5:44 pm
by pygr
Does turning analysis off cause a memory leak? In my setup I turn off analysis because, instead, I have the ONVIF event listener triggering events.

I'm now thinking perhaps it's better to put the "delete" command just before the "new" command for "packet->image" towards the beginning of Monitor::Decode(). That way, if I ever decide to turn on analysis, things should work properly.

Re: A memory leak located?

Posted: Tue Oct 10, 2023 7:33 pm
by pygr
Further investigation disproves the notion that packet->image is involved with a memory leak.

Sorry, my bad.

Re: A memory leak located?

Posted: Fri Oct 13, 2023 12:10 am
by pygr
Magic919 wrote: Sun Oct 08, 2023 7:43 am I’d suggest using Slack as that’s where the Developers hang out.
Good suggestion! Thanks.