mparaz
mparaz

Reputation: 2069

Android heap management for Bitmaps - how does Android not run out of memory?

I have a GridView with JPEGs loaded from the network.

I'm trying to find out the memory limits of my app.

I wrote a Robotium test to rapidly scroll through the GridView from top to bottom. Even when I have almost 300 JPEGs, the heap measured through Runtime.freeMemory() and the native heap through Debug.getNativeHeapFreeSize() are stable.

I am testing on the Eclair emulator, since my app needs to support Eclair.

Where does Android get the memory to store the Bitmaps? The numbers don't seem to add up.

Upvotes: 2

Views: 176

Answers (1)

akshaydashrath
akshaydashrath

Reputation: 1035

Does the Adapter you use for the GridView re-use views? If so its garbage collecting the images from the re-used imageviews once there no longer a reference to them.

Upvotes: 1

Related Questions