A memory leak located?

Current Development version likely to have breaking changes
Post Reply
pygr
Posts: 48
Joined: Fri Apr 21, 2023 11:49 pm

A memory leak located?

Post 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.
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: A memory leak located?

Post by Magic919 »

I’d suggest using Slack as that’s where the Developers hang out.
-
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: A memory leak located?

Post by iconnor »

I'm here. I'll take a look.
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: A memory leak located?

Post 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.
pygr
Posts: 48
Joined: Fri Apr 21, 2023 11:49 pm

Re: A memory leak located?

Post 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.
pygr
Posts: 48
Joined: Fri Apr 21, 2023 11:49 pm

Re: A memory leak located?

Post by pygr »

Further investigation disproves the notion that packet->image is involved with a memory leak.

Sorry, my bad.
pygr
Posts: 48
Joined: Fri Apr 21, 2023 11:49 pm

Re: A memory leak located?

Post 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.
Post Reply