Can some one please tell me, what kind of memory is dirty/resident, and where do they come from? Does resident memory means the same with "wired memory" of Mac OS?
this is what I saw about 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.
It's almost a year and I figured it out.
clean memory
clean memory are memories that can be recreated, on iOS it is memory of:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With