Giter VIP home page Giter VIP logo

Comments (4)

Petterpx avatar Petterpx commented on July 20, 2024

仅开启应用内浮窗会存在内存泄漏 具体操作步骤:在B页面开启悬浮,返回A页面

java.util.ArrayList instance Leaking: UNKNOWN Retaining 300 B in 16 objects ↓ ArrayList[11] ~~~~ com.petterp.floatingx.imp.app.FxAppLifecycleImp instance Leaking: UNKNOWN Retaining 213 B in 6 objects ↓ FxAppLifecycleImp.helper ~~~~~~ com.petterp.floatingx.assist.helper.FxAppHelper instance Leaking: UNKNOWN Retaining 544.4 kB in 8765 objects context instance of cn.qssmart.tytptt.util.config.MyApp ↓ FxBasisHelper.iFxClickListener ~~~~~~~~~~~~~~~~ cn.qssmart.tytptt.ui.setting.SetUpActivity$15 instance Leaking: UNKNOWN Retaining 544.2 kB in 8758 objects Anonymous class implementing android.view.View$OnClickListener this$0 instance of cn.qssmart.tytptt.ui.setting.SetUpActivity with mDestroyed = true ↓ SetUpActivity$15.this$0 ~~~~~~ cn.qssmart.tytptt.ui.setting.SetUpActivity instance Leaking: YES (ObjectWatcher was watching this because cn.qssmart.tytptt.ui.setting.SetUpActivity received Activity#onDestroy() callback and Activity#mDestroyed is true) Retaining 544.2 kB in 8757 objects key = cade785e-25e7-4cac-ab5d-db66c7186754 watchDurationMillis = 51480 retainedDurationMillis = 46478 mContext instance of cn.qssmart.tytptt.ui.setting.SetUpActivity with mDestroyed = true mApplication instance of cn.qssmart.tytptt.util.config.MyApp mBase instance of androidx.appcompat.view.ContextThemeWrapper

能带一下你在Activity中显示浮窗的示例代码吗?
另外,建议将展示浮窗的代码单独封装为一个静态,而不是直接在某Activiry中,避免对象无法回收。

from floatingx.

OneGreenHand-LXH avatar OneGreenHand-LXH commented on July 20, 2024


微信图片_20240326191403
微信图片_20240326191510

from floatingx.

OneGreenHand-LXH avatar OneGreenHand-LXH commented on July 20, 2024

改写在静态类了,貌似没啥问题了

from floatingx.

Petterpx avatar Petterpx commented on July 20, 2024

改写在静态类了,貌似没啥问题了

因为你注册了touchListener,这种匿名内部类的方式导致隐式持有了外部activity,从而内存泄漏

from floatingx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.