简体   繁体   English

在Android中执行Dalvik堆限制时是否计算共享内存?

[英]Is shared memory counted while enforcing Dalvik heap limit in Android?

I understand that any application in Android has some allocated memory- 我了解,Android中的任何应用程序都有一些已分配的内存-

(1) Dalvik VM heap - strict upper limit; (1)Dalvik VM堆-严格的上限; device-dependent. 依赖于设备的。

(2) Native heap - no limit. (2)本机堆-无限制。 The amount of memory allocated here is not taken into account while enforcing Dalvik heap limit. 强制执行Dalvik堆限制时,不会考虑此处分配的内存量。

Do correct me if I am wrong. 如果我错了,请纠正我。

I have a question regarding these- 我对这些有疑问-

When two apps are sharing memory in ashmem, is the shared amount of memory taken into account while checking if the Dalvik heap limit is crossed? 当两个应用程序在ashmem中共享内存时,在检查是否超过了Dalvik堆限制时是否考虑了共享内存量? What I mean is, when the Dalvik heap limit is being enforced, does the shared memory add to the tally? 我的意思是,当强制执行Dalvik堆限制时,共享内存是否会增加计数?

You are correct -- the Dalvik VM enforces a limit on the managed heap, but there is no fixed limit on native allocations. 您是正确的-Dalvik VM对托管堆施加了限制,但是对本机分配没有固定的限制。

ashmem allocations are not part of Dalvik's managed heap, so are not counted against the manged heap limit. ashmem分配不属于Dalvik托管堆的一部分,因此不计入托管堆限制。

The native allocations matter when the kernel's low-memory killer is looking for processes to discard. 当内核的低内存杀手正在寻找要丢弃的进程时,本地分配很重要。 I don't know if that uses PSS or some other measure to factor in shared memory when computing process usage. 我不知道在计算进程使用率时是否使用PSS或其他措施将共享内存考虑在内。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM