We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
这里有一些关于 android 内存管理的链接
详细的帖子
http://mobworld.wordpress.com/2010/07/ 05/memory-management-in-android/
还有一篇关于内存分析的不错的博客文章
http://android-developers.blogspot.com/2011 /03/memory-analysis-for-android.html
如何避免内存泄漏
http://android-developers.blogspot.co.uk /2009/01/avoiding-memory-leaks.html
Here are some links about memory management on android
A detailed post
http://mobworld.wordpress.com/2010/07/05/memory-management-in-android/
And a nice blog post for memory analysis
http://android-developers.blogspot.com/2011/03/memory-analysis-for-android.html
How to avoid memory leaks
http://android-developers.blogspot.co.uk/2009/01/avoiding-memory-leaks.html
Linux内核和jvm应该被视为苹果和橘子。混淆两者可能会造成灾难性的后果。
例如,linux内核的虚拟内存本质上是一个交换文件,并且没有对单个进程的大小设置限制,这会导致文件满时“颠簸”或无休止的交换。
形成鲜明对比的是,jvm(这只是另一个linux进程)为其应用程序设置了一个共同的最大大小(例如256MB)。 Android 应用程序通常在自己的 jvm 中运行,从而防止任何给定的 jvm 发生“颠簸”。相反,GC 将抛出 OOM 并退出。
当内核虚拟内存耗尽时,Android 将进一步终止应用程序(包含活动线程组任务的 jvm),并在需要时重新启动它们。它仍然可能冻结(崩溃),但不像例如那样频繁。无人值守的 Linux 数据库或 Web 服务器。
抖动(冻结)android 的解决方案与抖动 linux 服务器完全相同。弹跳(重新启动电源)。因为它是linux服务器。
考虑到 Android 为世界提供了数以百万计的完全连接但大多闲置的普遍 Linux 服务器,这些服务器可以托管无数的多线程进程(jvm 只是其中一种类型),这一点有点深刻。
它拥有终极超级计算机的骨架,即使是最复杂的数据中心也相形见绌。
更不用说大多数 Android 设备都拥有比 CPU 快 100 倍的并行处理器 (GPU),但同样处于闲置状态。除了少数知道如何激发它们的玩家之外。
只是作为概述,该线程上已经有很好的链接。
The linux kernel and the jvm should be treated as apples and oranges. Confusing the two can be disastrous.
For example, the linux kernel's virtual memory is essentially a swap file, and does not set limits on individual process size, which results in "thrashing" or endless swapping when the file is full.
In stark contrast, the jvm (which is just another linux process) sets a common maximum size for its applications (eg 256MB). Android apps generally run in their own jvms, preventing any given jvm from "thrashing". Rather the GC will throw an OOM and exit.
Android will further kill off apps (jvms containing tasks that are groups of activity threads) when running out of kernel virtual memory, and restart them later if required. It can still freeze up (thrash), but not as often as, for eg. an unattended linux database or web server.
The solution for a thrashing (frozen) android is exactly the same as a thrashing linux server. Bounce (cycle the power). Because it is a linux server.
It is somewhat profound to consider that Android has given the world millions of fully connected yet mostly idle pervasive linux servers that can host endless swarms of multithreaded processes (jvms are only one type).
It has the bones of the ultimate super computer, dwarfing even the most elaborate data centre.
That is not even mentioning that most androids have parallel processors (GPUs) that are 100s of times faster than their CPUs, again just sitting idle. Except for a few gamers who know how to fire them up.
Just intended as an overview, there are already excellent links on this thread.