flutter_boost icon indicating copy to clipboard operation
flutter_boost copied to clipboard

[Bug]: 使用fragmentactivity加载FlutterBoostFragment页面关闭时会内存泄露

Open chico0920 opened this issue 2 years ago • 2 comments

请描述遇到的问题,以及您所期望的正确的结果

使用fragmentactivity加载FlutterBoostFragment页面关闭时会内存泄露

请说明如何操作会遇到上述问题

新建页面,然后关闭页面

┬─── │ GC Root: Thread object │ ├─ Fl instance │ Leaking: NO (PathClassLoader↓ is not leaking) │ Thread name: 'CleanupReference' │ ↓ Thread.contextClassLoader ├─ dalvik.system.PathClassLoader instance │ Leaking: NO (FlutterEngineCache↓ is not leaking and A ClassLoader is never leaking) │ ↓ ClassLoader.runtimeInternalObjects ├─ java.lang.Object[] array │ Leaking: NO (FlutterEngineCache↓ is not leaking) │ ↓ Object[5342] ├─ io.flutter.embedding.engine.FlutterEngineCache class │ Leaking: NO (a class is never leaking) │ ↓ static FlutterEngineCache.instance │ ~~~~~~~~ ├─ io.flutter.embedding.engine.FlutterEngineCache instance │ Leaking: UNKNOWN │ Retaining 140 B in 4 objects │ ↓ FlutterEngineCache.cachedEngines │ ~~~~~~~~~~~~~ ├─ java.util.HashMap instance │ Leaking: UNKNOWN │ Retaining 128 B in 3 objects │ ↓ HashMap["flutter_boost_default_engine"] │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ├─ io.flutter.embedding.engine.FlutterEngine instance │ Leaking: UNKNOWN │ Retaining 1.0 kB in 33 objects │ ↓ FlutterEngine.dartExecutor │ ~~~~~~~~~~~~ ├─ io.flutter.embedding.engine.dart.DartExecutor instance │ Leaking: UNKNOWN │ Retaining 90 B in 3 objects │ ↓ DartExecutor.dartMessenger │ ~~~~~~~~~~~~~ ├─ io.flutter.embedding.engine.dart.DartMessenger instance │ Leaking: UNKNOWN │ Retaining 109.3 kB in 2290 objects │ ↓ DartMessenger.messageHandlers │ ~~~~~~~~~~~~~~~ ├─ java.util.HashMap instance │ Leaking: UNKNOWN │ Retaining 108.1 kB in 2234 objects │ ↓ HashMap["flutter/keyboard"] │ ~~~~~~~~~~~~~~~~~~~~ ├─ io.flutter.embedding.engine.dart.DartMessenger$HandlerInfo instance │ Leaking: UNKNOWN │ Retaining 104.9 kB in 2073 objects │ ↓ DartMessenger$HandlerInfo.handler │ ~~~~~~~ ├─ io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler instance │ Leaking: UNKNOWN │ Retaining 104.9 kB in 2072 objects │ ↓ MethodChannel$IncomingMethodCallHandler.handler │ ~~~~~~~ ├─ io.flutter.embedding.engine.systemchannels.KeyboardChannel$1 instance │ Leaking: UNKNOWN │ Retaining 104.9 kB in 2070 objects │ Anonymous class implementing io.flutter.plugin.common.MethodChannel$MethodCallHandler │ ↓ KeyboardChannel$1.this$0 │ ~~~~~~ ├─ io.flutter.embedding.engine.systemchannels.KeyboardChannel instance │ Leaking: UNKNOWN │ Retaining 104.8 kB in 2068 objects │ ↓ KeyboardChannel.keyboardMethodHandler │ ~~~~~~~~~~~~~~~~~~~~~ ├─ io.flutter.embedding.android.KeyboardManager instance │ Leaking: UNKNOWN │ Retaining 104.8 kB in 2067 objects │ ↓ KeyboardManager.viewDelegate │ ~~~~~~~~~~~~ ├─ io.flutter.embedding.android.FlutterView instance │ Leaking: YES (View.mContext references a destroyed activity) │ Retaining 104.4 kB in 2051 objects │ View is part of a window view hierarchy │ View.mAttachInfo is null (view detached) │ View.mID = R.id.null │ View.mWindowAttachCount = 1 │ mContext instance of pro.ui.base.flutter.BaseFlutterFragmentActivity with mDestroyed = true │ ↓ View.mContext

在下面填入关键复现代码

复现的平台

Android

Flutter SDK版本

3.13.6

FlutterBoost版本

4.4.0

是否延迟初始化FlutterBoost

No

解决方案

chico0920 avatar Oct 10 '23 06:10 chico0920

我也遇到了, 请问有没有解决方法

xing16 avatar Jun 27 '24 07:06 xing16