How to allocate more memory when running the app?

I am developing an app android

Currently, when I run the APP, it starts reserving 36.62 MB of memory.


insert the description of the image here


I would like it to start at the top of 50.00 MB or, when it reaches its limit, add more memory.


Is there any way to set the initial memory of the main Thread?

I know that when we declare a new Thread, we are able to allocate a size of stack for it as for example:

//https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html
//long stackSize define o tamanho da stack . . .
Thread(ThreadGroup group, Runnable target, String name, long stackSize)

But in the main Thread I don't know how to do


Would Anyone know how to guide me regarding this?

Author: CristianCotrena, 2018-02-20

1 answers

No Manifest.xml of your application add

 android:largeHeap="true"

This will cause it to use more memory than the default set, attention your application will not run spending more memory, but let's assume that before your application because it has many elements ends up bursting the standard memory that each app can consume, with this line it does not impose limit RAM consumption.

See More:

Whether your application processes should be created with a big pile Dalvik. This applies to all processes created to the app. Applies only to the first application loaded on a process; if you are using a shared user ID to allow multiple applications to use one process, they should all use this option consistently or will have results unpredictable. Most applications should not need this and should focus on reducing the overall memory usage to improve the performance. Enable this it also does not guarantee a fixed increase in available memory, because some devices are limited by total memory available.

Https://developer.android.com/guide/topics/manifest/application-element.html

 1
Author: Steve Rogers, 2018-02-20 20:26:11