Giter Club home page Giter Club logo

Comments (7)

ctiao avatar ctiao commented on August 25, 2024

这样改没有问题。
不过有点奇怪如果JsonSource的实例被回收,他的成员应该也会被回收的,JsonSource在BaseDanmakuParser里的parse()之后已经release并且置null, 为什么mJSONArray没有被一起回收呢

from danmakuflamemaster.

yrom avatar yrom commented on August 25, 2024

你是如何得知“jsonArray并没有被回收掉”

from danmakuflamemaster.

xiaojianan avatar xiaojianan commented on August 25, 2024

当我的视频播放的fragment被remove后,查看内存,发现弹幕的相应数据还存在内存中,弹幕的release方法有调用,具体的还没有分析清楚,但看起来像是DanmakuLoader在持有mJsonArray的引用:
7d801a3a-959f-40e8-a643-10da08ffae05

from danmakuflamemaster.

xiaojianan avatar xiaojianan commented on August 25, 2024

请帮忙看下是不是这样,AcFunDanmakuLoader的instance持有JSONSource dataSource对象,在JSONSource中,release后,mJSONArray并没有被回收,而AcFunDanmakuLoader的instance对象不会被回收,最终导致了mJSONArray不能被回收。

from danmakuflamemaster.

xiaojianan avatar xiaojianan commented on August 25, 2024

ef65de91-146a-4814-8939-b0062b377593
补一张我在release中将mJsonArray置为null后的内存,可以看见,AcFunDanmakuLoader依旧存在内存中,但是mJsonArray因为已经被回收,所以AcFunDanmakuLoader对象已经不占用内存。我怀疑跟fragment有关,如果是activity中应该不存在此问题。

from danmakuflamemaster.

yrom avatar yrom commented on August 25, 2024

应该是静态变量instance的问题

from danmakuflamemaster.

ctiao avatar ctiao commented on August 25, 2024

提交个pull request 吧

from danmakuflamemaster.

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.