How do I get more memory to run the app?

Asked

Viewed 554 times

0

I’m developing an app

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


inserir a descrição da imagem aqui


I would like it to start over 50.00 MB or, when it reaches its limit, add more memory.


Is there any way to define the initial memory of the main thread?

I know that when we declare a new Thread, we can allocate a stack size for it like:

//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


Someone would know my way around?

  • 1

    By JVM’s default it’s slowly releasing memory, according to demand, and of course there’s a limit, for applications that use more memory can be set in the manifest to increase it according to the answer @Rogers Marques posted, vc can see more details of the memory consumption error at this link: https://stackoverflow.com/questions/21012006/android-outofmemoryerror

1 answer

1


In the Manifest.xml of your application add

 android:largeHeap="true"

this will make it use more memory than the set pattern, attention your application will not run spending more memory, but let’s assume that before your application has many elements end up popping the default memory that each app can consume, with this line it does not impose limit of memory consumption.

See more:

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.