Android heap size and SoftReferences

I have an application that creates a series of bitmaps. I keep these bitmaps in SoftReferences to avoid running out of memory. I would like the heap size to grow to a maximum of 16 MB before it starts collecting my SoftReferences. However, SoftReferences are collected very willingly, before the heap is maximized. Is there a way to make links assemble less readily? or manually increase the heap to the maximum? Perhaps a way to just run the application with 16 MB allocated?

+3
source share
2 answers

There is currently no way to change the behavior of the SoftReference collection.

, " ".

Bitmap ( - ), , " ", . (, , GC, GC. , , GC OOM.)

+3

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


All Articles