search

Home  >  Q&A  >  body text

android内存泄漏问题

生命周期更长的静态变量持有旧context会导致context无法释放造成泄漏,那能不能通过将静态变量置为null来解决?

迷茫迷茫2771 days ago468

reply all(3)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 17:26:59

    This is OK if there is no other object referencing this context.

    reply
    0
  • PHPz

    PHPz2017-04-17 17:26:59

    You can use weak references.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 17:26:59

    It can be released, but in such cases, application context will generally be considered

    reply
    0
  • Cancelreply