What exactly is behind / inside iPhone memory management?

This question is NOT about saving / releasing things in iphone memory management. I am good at routine and there are no memory leaks in my application.

I will bring up the question indicated in the title when I use Activity Instruments to monitor the total memory activity in my application.

The tool always shows that the amount of "real memory" that my application uses continues to be between 21 MB and 30 MB, never again. I think this amount is relatively small. However, sometimes my application will issue a level 1 or 2 warning (never crashing, and I do nothing for this warning in my code).

so I wonder what really stands for iphone memory. I mean, is real memory really the only thing that triggers warnings? or anything else (like virtual memory, as shown in the Tools) in all the memory that I have to take care of?

Although my application never crashes due to memory problems, this warning thing (especially the Level 2 warning) really annoys me and makes me afraid of a breakdown as soon as I release it to the public in the future.

Any help?

thanks

+4
source share
1 answer

Memory warnings exist to tell your application that you are approaching your limit. They are not necessarily β€œbad” - many applications simply ignore them.

The actual implementation information when the warning about the availability of memory is triggered does not matter, and in fact it will differ significantly from device to device. The iPhone 4 may have 512 MB of RAM, but 3GS will be half as much.

However, there are some things worth knowing about memory warnings:

  • A memory warning is triggered when the total amount of free memory reaches a certain level.
  • These levels are undocumented. So you don’t know what the difference between a Level 1 warning and a Level 2 warning, other than fact 2, is worse (more urgent) than 1
  • Memory alerts do not apply to specific applications. A memory warning is delivered to all running applications and does not pause. Therefore, you cannot be directly responsible for launching one of them.
  • When you receive memory alerts, the system will try to free memory on your behalf.

Again, the details of a particular implementation are not documented, and you do not need to worry about them. A memory warning is an opportunity for you to help the system by freeing up any objects that you do not need.

+4
source

All Articles