[英]How to increase RAM usage programmatically in Android?
I need to increase RAM usage in Android programmatically to observe it changes in time. 我需要以编程方式增加Android中的RAM使用量,以便及时观察它的变化。 How can i do this? 我怎样才能做到这一点?
I tried to generate a lot of custom objects, but unexpectedly RAM usage decreases after generating it... I changed objects quantity, structure etc and nothing helps me. 我试图生成很多自定义对象,但是在生成它之后意外地降低了RAM的使用量......我改变了对象的数量,结构等,没有什么能帮助我。
I watch RAM usage in Android Profiler. 我在Android Profiler中观察RAM使用情况。
TypeFace
are allocated in Native memory and it makes Native heap size large, hence RAM usage gets increased a lot. 由于TypeFace
在Native内存中分配,并且它使Native堆大小变大,因此RAM使用量增加了很多。 Refer to this answer to an inquiry on why an app takes up more memory for exploring the reason. 请参阅此答案 ,了解为什么应用占用更多内存以探索原因。 ByteArrayInputStream
and allocate MAX sizes. 添加ByteArrayInputStream
并分配MAX大小。 It will keep the memory as long as it's not destroyed. 只要它没有被破坏,它就会保留记忆。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.