For versions prior to 3.0 honeycomb: Yes, do call System.gc()
.
I tried to create Bitmaps, but was always getting “VM out of memory error”. But, when I called System.gc()
first, it was OK.
When creating bitmaps, Android often fails with out of memory errors, and does not try to garbage collect first. Hence, call System.gc()
, and you have enough memory to create Bitmaps.
If creating Objects, I think System.gc
will be called automatically if needed,
but not for creating bitmaps. It just fails.
So I recommend manually calling System.gc()
before creating bitmaps.