Implications of not using frame->Release();

Post Reply
LamarLatrell
Posts: 26
Joined: Tue Dec 09, 2014 4:47 pm

Implications of not using frame->Release();

Post by LamarLatrell »

hello,

Strange discovery in my code this evening - the line:

frame->Release();

was commented out ... but with no apparent issues in my program.

However, upon uncommenting it my program will stall almost immediately. No idea why or how it was commented, and unfortunately no idea when. Line count is in the 4 figures and I've spent time on most sections of it lately so I cant easily retrace my code additions to see what the clash is. (opencv project)

Keeping in mind it is working at the moment - two questions:
  • ->is leaving it commented pretty much implementing a memory leak?
    ->what, if any other implications are there?
:|
Last edited by LamarLatrell on Wed Mar 04, 2015 4:18 pm, edited 1 time in total.
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 720
Joined: Mon Jan 19, 2015 11:52 am

Re: Implications of not using frame->Release();

Post by steven.andrews »

Hello LamarLatrell,

Both not releasing a frame, and releasing a frame more than once, will result in a stall. From your description, it almost sounds like leaving that line uncommented is causing the frame to be released twice. You may want to double check your code to be sure that the frame is not being released elsewhere.

Best regards,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer
LamarLatrell
Posts: 26
Joined: Tue Dec 09, 2014 4:47 pm

Re: Implications of not using frame->Release();

Post by LamarLatrell »

Fair logical skills there Steven - you're quite correct!

Yes, the line was copied to an earlier spot in the code, right after the frame was last used. I can only assume I must have done it on one of my very late nights ... and commented out the original (which was at the end of the full loop) as a 'reminder' of the change :roll:

Although the late nights can be productive in terms of implementing new ideas, they are wanting in terms of code management ;)
Post Reply