When profiling my application using tools (in search of memory leaks), I get completely different results with iPhone Simulator iOS 5 from those that I get from my iPhone 4 running iOS 5. The first figure shows the results of profiling using a real device and the second with a simulator:
Real device:

iOS 5 Simulator:

In both cases, this profile applies to the same point in the application: terminating viewDidLoad in the rootViewController's viewing lifecycle. I waited in both of them that the shared memory was stabilized. As you can see on the device graph, there are some extreme fluctuations that occur around 00:10, which are not in the simulator. On a real device, the total allocated memory at about 00:08 jumps from 1 MB to 3.5 MB, then back down to 1.5 MB and finally goes to 4.74, where it stabilizes. The allocated memory for the Simulator is much more linear, while it rises stably and quickly to about 2.35 MB, where it stabilizes.
Another thing worth noting is the presence on the device of 2.25 MB of allocated memory, but not the simulator from malloc and 700+ KB from CFNumber. Since I'm relatively new to using tools and profiling, I'm not entirely sure if this is normal. A quick Google search showed nothing final. This is 2.25 MB and 700 KB more than compensate for the difference in memory allocation. To balance the situation, there are more entries for malloc with different amounts of memory present in the Simulator test, which is not in the device test.
In addition, I found that when the second UIViewController is pushed onto the UINavigationController stack, the allocated memory jumps about 8.5-9 MB on a real device, but only 4.5 to 4.5 megabytes of vertices on the simulator.
I know that it should be expected that the device will work differently compared to Simulator, but should the memory allocation not be very similar, because the same code runs on both devices? I would understand if this is a performance profiling, but for memory allocation it seems that the numbers should be very similar. Can anyone shed light on whether this is normal or not?
memory-management ios iphone instruments
eric.mitchell
source share