开发者

Android virtual memory and paging [closed]

开发者 https://www.devze.com 2023-02-24 05:19 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 1 year ago.

开发者_运维百科 Improve this question

Can anyone elaborate or provide a link to android memory management. I am confused about Android virtual memory scheme. How is paging done in Android? Without a hard disk, how do they do it? Do they have caching?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消