-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Memory leak when using PlatformView [IOS] #24714
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
Comments
Is this with video player logic active or just opening/closing PlatformViews? |
I met same case. when I rebuild the render tree that platform view has inserted, the native method 'create' will be called. However, It is not my expectation all the time. for example, sometimes I only wanna change my platform layout. |
platform -> platform view |
the plugin's code is written like flutter's webview_flutter plugin |
I don't think this is a Flutter bug, for comparison here's what the memory graph looks like when I open and close the "scrolling map" page in the Google Maps demo (which have 2 Google Maps in it): (the spikes are when the maps page is open, and you can see it goes down when the page is closed) I would guess that the RTMP video plugin is causing a leak. @qypengzai note that the lifecycle of the underlying platform view is the same as the lifecycle of the UiKitView widget's state. If you want to e.g move it in the widget tree you need to ensure you don't lose state by setting a key on the widget. |
@amirh Thanks for replying, I have constructed an IJKPlayer video plugin in a textured way to support live streaming and on-demand streaming. Through the way of texture, I have not encountered the above problem. |
Finally found a solution ✌️ |
IOSGLRenderTarget::~IOSGLRenderTarget() {
[EAGLContext setCurrentContext:context_];
FML_DCHECK(glGetError() == GL_NO_ERROR);
// Deletes on GL_NONEs are ignored
glDeleteFramebuffers(1, &framebuffer_);
glDeleteRenderbuffers(1, &colorbuffer_);
FML_DCHECK(glGetError() == GL_NO_ERROR);
} |
Thanks for the investigation and fix @ashawn! In general I encourage you to file issues, or re-open closed issues if you think it's a mistake and the issue is not resolved. For this fix(and any other fix) I'd encourage you to send a PR with the fix to the Flutter Engine so everyone can benefit. Thanks! |
Hi I have sent a PR with the fix to the Flutter Engine, flutter/engine#7919 |
@ashawn thank you ! I build Flutter_IJKPlayer plugin by Texture ,now,not use PlatformView |
flutter/engine@33bb91c...f80928a git log 33bb91c..f80928a --no-merges --oneline f80928a Roll src/third_party/skia fdd15284affe..ee1c8a733e5b (15 commits) (flutter/engine#7924) 93f339f fix Memory leak when using PlatformView [IOS] #24714 (flutter/engine#7919) 2d33e77 Roll src/third_party/skia 969659dbb313..fdd15284affe (2 commits) (flutter/engine#7922) 6d4edf2 Roll src/third_party/skia 9431161ca973..969659dbb313 (3 commits) (flutter/engine#7921) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (amirha@google.com), and stop the roller if necessary.
remove //fix platformview memory leak flutter/flutter#24714 [EAGLContext setCurrentContext:context_.get()];
@amirh @zoechi @mravn-google @timtraversy Problem: Why it is a critical issue: Replicate: Request: Evidence: |
@darkmarthur can you file a new issue for this, there was a memory leak in destruction of platform views that was fixed a few months ago not sure if you got it or not, can you include the output for Thanks! |
@amirh `[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G87, locale zh-Hans-CN) [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2) Can you try to analyze this problem, and look forward to your answer. This problem will cause our application memory to grow until it crashes, hoping to give us a solution. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
NSLog
The text was updated successfully, but these errors were encountered: