How do I allocate more memory in the app execution?

0

I'm developing an

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

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 have been able to allocate a stack size for it, 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 do not know how to do

Would anyone guide me on this?

    
asked by anonymous 20.02.2018 / 20:58

1 answer

1

In the Manifest.xml of your application add

 android:largeHeap="true"

This will make it use more memory than the default set, attention your application will not run by spending more memory, but let's assume that before your application has too many elements to break the standard memory that each app can consume, with this line it does not impose ram memory consumption limit.

See more:

  

If the processes of your application should be created with a   large Dalvik battery. This applies to all processes created for   the application. Applies only to the first application loaded in a   process; if you are using a shared user ID for   allow multiple applications to use a process, all of them must   use this option consistently or have results   unpredictable. Most applications should not need this, and   should focus on reducing overall memory usage to improve   performance. Enabling this also does not guarantee a fixed   available memory, because some devices are limited by the   memory available.

link

    
20.02.2018 / 21:20