android - How much memory is allocated to this Bitmap? -
i'm not quite sure how memory allocated following variable "bitmap",
bitmap bitmap = bitmapfactory.decoderesource(getresources(), r.mipmap.example); bitmap = bitmap.createscaledbitmap(bitmap, 100, 100, true);
say, dimension of original image 1024*768 , memory has been allocated bitmap. bitmap scaled 100*100, , memory allocated variable "bitmap" changed due change of dimension?
a variable ever takes small amount of memory (if any). few bytes @ most. variable of object type uses enough memory store pointer object.
objects pointed variables, however, can take amount of memory. createscaledbitmap creates new bitmap after code run there 2 bitmaps in memory. 1 of them (the original, larger one) no longer has live references (e.g. variables) pointing it, garbage collected.
Comments
Post a Comment