Yes, generally if your GridView
is infinite, then your Adapter
is infinite. If you have a naive implementation of just loading more data into memory then you will certainly run into a memory problem at some point. To get around this, you will have to release old data at some point.
Assuming your adapter has access to some "infinite" store where it gets its data from (oftentimes the internet), you could consider setting a maximum size (either in bytes or in item count) of data to hold in memory for your adapter. When you get past the maximum size, you can purge old items from memory. If these old items are requested again, you load them again from the infinite store instead of from memory (and probably other old items are purged from memory).
This means your GridView
items are built from an Adapter
which stores data in some sort of cache (LruCache
could be useful here) which is backed by some (probably external) store. You could also put a disk cache between the memory cache and the external store.