How to specify more than 64 mb memory for an application?

largeHeap = "true" does not increase the heap size to or by 64 MB:

Most apps should not need this and should instead focus on reducing their overall memory usage for improved performance. Enabling this also does not guarantee a fixed increase in available memory, because some devices are constrained by their total available memory. (source, emphasis mine).

Which means using the largeHeap flag just tells Android that your app is memory-intensive and needs a larger heap. On some devices, it means it can get 200-300 MB, on others 50 MB. And that depends on the free memory.

In addition, the memory your app gets is decided by the system, so you cannot set it manually. There are no Xmx flags or similar on Android. `

TL;DR: You cannot specify a specific heap size like you can on desktop Java. Using largeHeap doesn’t give a fixed amount of memory to your app; it depends on the device and available memory. And whereever possible, save memory instead of requesting more as the docs of largeHeap states (Most apps should not need this and should instead focus on reducing their overall memory usage for improved performance)

Leave a Comment