1

So basically, I have a Vector class in which all bitmaps are stored so that I can have a dynamic array. What I actually do is something like this:

Bitmap bmp = Bitmap.decodeResource(context.getResources(), context.getResources().getIdentifier(imageName, "drawable", "com.example.dynamicbitmap");
vector.add(bmp);

What I would like to ask is that.. if I call vector.remove(value), would it free some space in heap space? In short, would the bitmap be automatically recycled? Or do I have to manually invoke it before removing the bitmap object from the vector?

4

1 回答 1

1

它不会立即释放内存。只要 GarbageCollector 决定这样做,就会对过时的位图进行 GC。所以基本上你不必打电话recycle(),但OutOfMemoryException如果你会用完内存,你可以结束。

如果你想尽快释放内存 - 你需要recycle()打电话

于 2013-02-07T03:25:41.170 回答