flutter_native_admob icon indicating copy to clipboard operation
flutter_native_admob copied to clipboard

Memory leak. NativeAdmob widget is not disposed.

Open petro-i opened this issue 4 years ago • 3 comments

How to reproduce:

  1. Start application containing NativeAdmob widget (even with no external or with controller used).
  2. Open Dart DevTools.
  3. Navigate back and forward to/from application screens containing/not containing NativeAdmob widget.
  4. Observe "Memory" page in DevTools. Take memory snapshot.
  5. Memory snapshot shows several not disposed NativeAdmob widget instances (as well as NativeAdmobController's). Make sure you do not filter any classes in snapshot.

AndroidView widget is not disposed also.

petro-i avatar Apr 27 '20 17:04 petro-i

Did you fix this ? Is there any fix for this yet ?

Nikolak47 avatar May 18 '20 13:05 Nikolak47

The native view has known issue with memory leak

duyduong avatar Jun 26 '20 13:06 duyduong

For anyone struggling with this topic. The memory leak has been fixed in https://github.com/flutter/flutter/pull/50111

At the time of writing the pull request is available in the following tags:

$ git tag --contains 26fabcd41bfa5beaedf718da9d59a0e84cf1cc0d
1.19.0-2.0.pre
1.19.0-3.0.pre
1.19.0-4.0.pre
1.19.0-4.1.pre
1.19.0-4.2.pre
1.19.0-4.3.pre
1.19.0-5.0.pre
1.20.0-0.0.pre
1.20.0-1.0.pre
1.20.0-2.0.pre
1.20.0-3.0.pre
1.20.0-7.0.pre
1.20.0-7.1.pre

If you dare, you can switch to the beta channel:

$ flutter channel beta
Switching to flutter channel 'beta'...
# some outputs omitted....
Successfully switched to flutter channel 'beta'.
To ensure that you're on the latest build from this channel, run 'flutter upgrade'

$ flutter upgrade
# even more outputs omitted...

$ flutter --version
Flutter 1.19.0-4.3.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 8fe7655ed2 (2 weeks ago) • 2020-07-01 14:31:18 -0700
Engine • revision 9a28c3bcf4
Tools • Dart 2.9.0 (build 2.9.0-14.1.beta)

But please beware that this is a beta release...

avbk avatar Jul 17 '20 08:07 avbk