Android: too much allocated memory when using png instead of vector images

I use 10 PNG images of 20-30 KB in imageView, but the allocated memory increases from 70 MB to 270 MB when loading this activity. So why is this too much memory allocated for these images.

This is a screenshot of the memory allocation

enter image description here

This is one of my images.

enter image description here

+4
source share
2 answers

File size does not matter. No, it’s important that your image is 20 KB, but its resolution is quite large. When an image is loaded into memory, it is equal to the memory totalNoOfDotsInImageBitmap * 4 bytes and totalNoOfDotsInImageBitmap = width * height of the image.

4 - - ARBG (1 )

.

+2

, , , .

, drawable nodpi-drawable, .

, , , , , - , , , , , OOM.

, ( , ), AS PNG .

0

Source: https://habr.com/ru/post/1679721/


All Articles