-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rs2_extract_frame documentation unclear or inaccurate #13780
Comments
Hi @GrubbyHalo rs2_extract_frame is usually only used in RealSense 'C' language code rather than C++ so the number of code references available that demonstrate this instruction is limited, unfortunately. If you are using C code and experiencing a memory leak due to unreleased frames, is your program releasing resources like in the rs-distance C example? |
@MartyG-RealSense i have two functions that get called in a loop:
The above causes a memory leak even though the documentation implies this is the correct thing to do (Read the only comment in grab_frame ) If i modify the grab_frame function so that it doesn't increasr the reference count on the to sub frame...i.e./ by removing:
Then I have no more memory leaks. |
Thanks very much for sharing your findings, @GrubbyHalo I added a Documentation link to this issue. Let's keep it open and see if any other C users report a similar experience to yours. |
The rs2_extract_frame API documentation says:
If you wish to keep this frame after the composite is released, you need to call acquire_ref Otherwise the resulting frame lifetime is bound by owning composite frame
The example code and sources seems to contradict this as they specifically release the sub frames in addition to releasing the composite frame.
Also I have found if i stick to the above recommendation of acquiring the subframes after releasing the composite frame i get a memory leak as a consequences of effectively having acquired the sub frames twice but only releasing once.
The text was updated successfully, but these errors were encountered: