Open jamesguoxin opened 6 years ago
I met this error too, if you solve it , please help me ~
I think it could be that you're not waiting for the process to finish before releasing it and starting it again. Use an AsyncTask
then in onPostExecute
release FFmpegMediaMetadataRetriever
then pass the next path until completed.
When you call FFmpegMediaMetadataRetriever
repeatedly without waiting for processes to finish will cause out of memory exception (memory leak).
How is it possible to know when it has completed, in a for loop of items to process? How is the stup of the AsyncTask
? Considering, am already doing this heavy work in a background thread, but it still seems to hog onto memory the more items I have in the list to process.
I conclude that since the object des did not have a Singleton, it will lead to several of class objects created having different instances. This would quickly lead to OOM.
We are using this code to load video and process frames with OpenCV. A simple example is as following:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever(); mmr.setDataSource(mUri); mmr.release();
Then we start to process one thousand videos to test our mobile algorithm, but according to Android Profiler, the native memory goes to infinity and our app crushed after a few runs. We suspect that FFmpegMediaMetadataRetriever release method doesn't work as it expected. We've tried to pinpoint the exact problem, however, we didn't have a clue. It would be much appreciated if anyone could land a hand. Thanks!!!!