iPhone - Memory allocation slightly increasing
I run my app in Instruments in order to look for the possible memory leaks. I currently don't have any leaks. However, I would like to have some help interpreting the memory allocation.开发者_如何学C When I'm in the first screen, let's say the memory allocation is 1.50 MB. When I navigate to the second screen the memory allocation is 1.80 MB. When I navigate back to the first screen, the memory allocation is 1.55 MB. Is it expected that when I navigate to the first screen, the memory is not as low as at the beginning?
Seeing memory usage increase like this is usually down to one of two things.
- Some objects are caching data in memory, to make it faster to reload if you access those resources again (images may do this)
- You have a memory leak
You can usually tell the difference between the two by doing the task a few times and seeing if the memory increases each time. So for example, if you go to your second screen and back 10 times and the memory allocation on the first screen increases each time, you probably have a leak.
精彩评论