Muhammed Refaat
Muhammed Refaat

Reputation: 9103

What happens to changed Images

In android app, images can be changed through run-time (e.g. layout-bg, ImageButton-src, Button-bg, ..etc), so what happens to the old image in the terms of memory occupation? is it removed or still occupy a portion from the memory? and if it's not removed, how can I clear the memory from this image?

Upvotes: 1

Views: 25

Answers (1)

Kasra
Kasra

Reputation: 3145

UI part of android is mainly written in Java -- once all references to a bitmap is gone, the bitmap will be flagged for garbage collection. If you do not use a bitmap texture, and you have no reference to that bitmap anywhere in the code the memory will be freed immediately. Please be careful about memory leak in android. Read this: http://android-developers.blogspot.ca/2009/01/avoiding-memory-leaks.html

Upvotes: 1

Related Questions