-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
How to clear the cloned frame correctly? #1574
Comments
The underlying methods use Pointer to allocate memory, so we can use PointerScope in the fashion introduced here: |
Ideally though it should probably implement |
However, that's going to require adding reference counting for pointers in other areas of FrameConverter, FrameGrabber, FrameFilter, and FrameRecording, so let's add that to the "to-do list". |
Thank you for your reply. The frame I cloned is passed to the child thread for use, so what if I use this PointerScope |
That's fine, you can pass the PointerScope to the thread as well, possibly after calling PointerScope.extend(). |
Can you give me a sample code? I'm sorry, I still don't know how to use it |
There's some more sample code in the unit tests here: |
Please help to see if the following code is correct?
|
Yes, that should work... But if you have a lot of those frames, you should create single instances of everything and reuse them. |
It works. Thank you very much! |
The |
When I use the clone method on frame, I find that the memory has been increasing and has not been released. I see that the comment of the method says:"Expect a heap overflow exception when using this method without cleaning up."
Can you tell me how to clear the frame object correctly?
I would like to ask, in addition to passive garbage collection, is there any way to manually free memory?
The text was updated successfully, but these errors were encountered: