Java – Android VM heap size

I can't understand what Android App heap size is

Runtime rt = Runtime.getRuntime();
long maxMemory = rt.maxMemory();
Log.v("onCreate","maxMemory:" + Long.toString(maxMemory));

Dysplays 50331648 = 48MB, but dumpsys meminfo displays native 13 16 12 84028 83457 18

I can easily allocate 74MB

int size = 1024*1024*74;
char* s = new char[size];

Solution

Well, heap size is actually a programming concept, far beyond its Android You can read it here, but it does (short story) how much memory the VM uses, and it is allocated independently of your application

The memory allocated to your application is dynamically allocated So if you ask your application to allocate more memory, you'll see it grow But it cannot grow indefinitely

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>