jakky1 / video_player_win

Flutter video player for Windows, lightweight, using Windows built-in Media Foundation API. Windows implementation of the video_player plugin.
BSD 3-Clause "New" or "Revised" License
35 stars 11 forks source link

Memory Leak #4

Closed ardivee closed 1 year ago

ardivee commented 1 year ago

When disposing the controller it does not fully release all the memory.

jakky1 commented 1 year ago

Hmm... after a lot of hard work, I still have no idea why memory leaks.

Use some memory leak detection tools, such as _CrtDumpMemoryLeaks in C++, didn't show there is any large memory leak occurs after play-dispose-play 100 times... But the Windows Resource Monitor does show the memory usage becomes bigger and bigger during test...

Now I found that the memory leak can be totally eliminated if I remove all the code in OnProcessSample in video_player_win_plugin.cpp , So I think the MyPlayerInternal::m_pBuffer may be the root cause of memory leak, but I have no idea why it leaks now :(

I will keep trying ~

jakky1 commented 1 year ago

Good news ! I tried to build with Flutter 3.7.0, without any code changes, and... there is no memory leaks ~

Please try to build with Flutter 3.7.0 (released in stable channel already)

ardivee commented 1 year ago

That fixed it!