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?
thi
Resident memory is the memory that is allocated for your app. Dirty memory is the resident memory that cannot be automatically deallocated due to the lack of a paging system in iOS. I found this information at http://liam.flookes.com/wp/2012/05/03/finding-ios-memory/. Then for the types of memory that you listed, resident memory in iOS is closer to real or private. From my understanding, it is the dirty memory that you should be most concerned about in iOS as it can determine if your app gets killed when suspended in the background if there is a low-memory condition.
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.