Skip to content
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

releasing Frame object #1152

Closed
Hosseinyzr opened this issue Mar 6, 2019 · 9 comments
Closed

releasing Frame object #1152

Hosseinyzr opened this issue Mar 6, 2019 · 9 comments

Comments

@Hosseinyzr
Copy link

Hi, Actually I have question.
for some reasons I want to keep an array of Frame objects. I use FFmpegFrameGrabber for extracting gif frames. and I call frame.clone to keep the original Frame.
I want to know when I am done , how can I release that Frame Objects?
is it correct just to assign each element of Frame[] to null ?

@saudet
Copy link
Member

saudet commented Mar 6, 2019 via email

@Hosseinyzr
Copy link
Author

Hosseinyzr commented Mar 9, 2019

so you mean there is no way to free them?
currently I assign them to null and then call this method:

 public static void freeMemory() {
        System.runFinalization();
        Runtime.getRuntime().gc();
        System.gc();
    }

is this useful?

@saudet
Copy link
Member

saudet commented Mar 9, 2019 via email

saudet added a commit that referenced this issue Mar 14, 2019
@saudet
Copy link
Member

saudet commented Mar 14, 2019

With the changes in commit 924f1d9, we can now control the deallocation of frames using a PointerScope as demonstrated on this page: http://bytedeco.org/news/2018/07/17/bytedeco-as-distribution/

Let me know if you encounter any problems with this! Thanks

@gudduIgn
Copy link

Hey Thnak you so much for resolving this, it was a big relief for me

@gudduIgn
Copy link

hey i am still facing the memory leak issue, although memoory leak decreased but i am still facing the issues

@saudet
Copy link
Member

saudet commented Mar 27, 2019

@gudduIgn You'll need to provide some details about what you're doing if you expect someone to help!

@saudet
Copy link
Member

saudet commented Apr 11, 2019

The changes have been released as part of JavaCV 1.5. Thanks for reporting and enjoy!

@saudet saudet closed this as completed Apr 11, 2019
yinmingjun pushed a commit to yinmingjun/javacv that referenced this issue May 24, 2019
@saudet
Copy link
Member

saudet commented Jun 18, 2020

BTW, I think I've fixed all the memory leaks occurring in FFmpegFrameGrabber and FFmpegFrameRecorder.
Please give it a try with the snapshots: http://bytedeco.org/builds/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants