IOS MAC OS内存概念

IOS Memory:

clean memory

clean memory are memories that can be recreated, on iOS it is memory of:

  • system framework
  • binary executable of your app
  • memory mapped files

Also notice this situation: when your app link to a framework, the clean memory will increase by the size of the framework binary. But most of time, only part of binary is really loaded in physical memory.

dirty memory

All memory that is not clean memory is dirty memory, dirty memory can't be recreated by system.

When there is a memory pressure, system will unload some clean memory, when the memory is needed again, system will recreate them.

But for dirty memory, system can't unload them, and iOS has no swap mechanism, so dirty memory will always be kept in physical memory, till it reach a certain limit, then your App will be terminated and all memory for it is recycled by system.

virtual memory

virtual memory = clean memory + dirty memory.

That means virtual memory is all the memory your App want.

resident memory resident memory = dirty memory + clean memory that loaded in physical memory resident memory is the memory really loaded in your physical memory, it mean all the dirty memory and parts of your clean memory.

conclusion

At any time, this is always true:

virtual memory == (clean memory + dirty memory) > resident memory > dirty memory

If you are worrying about the physical memory your App is taking(which is the key reason your App is terminated due to low memory), you should mainly focus on resident memory.


MAC OS Memory:

Wired : This refers to kernel code and such. Memory that should not ever be moved out of the RAM. Also know as resident memory.

Shared : Memory that is shared between two or more processes. Both processes would show this amount of memory so it can be a bit misleading as to how much memory is actually in use.

Real : This is the "real" memory usage for an application as reported by task_info() - a rough count of the number of physical pages that the current process has. (RSIZE)

Private : This is memory that a process is using solely on it's own that is used in Resident memory. (RPRVT)

Virtual : The total amount of address space in the process that's mapped to anything - whether that's an arbitrarily large space for variables or anything - it does not equate to actual VM use. (VSIZE)

Active : Memory currently labelled as active and is used RAM.

Inactive : "Inactive memory is no longer being used and has been cached to disk. It will remain in RAM until another application needs the space. Leaving this information in RAM is to your advantage if you (or a client of your computer) come back to it later." - Mac OS X Help

Free : The amount of RAM actually available without any data.


转自:http://stackoverflow.com/questions/13437365/what-is-resident-and-dirty-memory-of-ios

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值