Android - Memory leak when dynamically building UI with image resource backgrounds

前端 未结 2 547
面向向阳花
面向向阳花 2021-02-04 15:39

I have an Activity that I swear is leaking memory. The app I\'m working on does a lot with images, so I\'ve had to be pretty stingy with memory when working directly with Bitma

2条回答
  •  离开以前
    2021-02-04 16:10

    This is going to sound a little odd, but I have had trouble with apps that did any bitmap manipulation on a thread other than the one associated with the Handler for your Activity. In particular, I had an app that was leaking a lot of memory by doing image manipulation in a java.util.Timer thread. When I migrated that code over to using Handler.postDelayed, the memory issues cleared themselves up.

提交回复
热议问题