Re: Memory usage: Xcode vs. Instruments, who is right?
Re: Memory usage: Xcode vs. Instruments, who is right?
- Subject: Re: Memory usage: Xcode vs. Instruments, who is right?
- From: Han Ming Ong <email@hidden>
- Date: Fri, 06 Dec 2013 13:45:33 -0800
Markus,
If your app is running on the Mac, Xcode’s memory report will show the same number as Activity Monitor’s ‘Memory’ number. That’s because Xcode and Activity Monitor (for that matter, /usr/bin/top) make the same system call to understand your app’s memory usage. Of course we don’t have Activity Monitor nor ‘top’ for your iOS app. Regardless, Xcode makes the same system call on iOS to get your app’s memory usage. One of the reasons that you don’t see the memory drop could be because the system has not reclaimed the freed memory from your app. It uses different heuristics to make that determination. Try this : when your app is running and you switch to another app that consumes a lot of memory, check if Xcode reports a drop in memory usage. I wouldn’t rule out a bug in Xcode’s implementation and so please file a bug if you think there is a problem. We would love to investigate the issue.
Xcode records a lot less because it doesn’t want to slow down the target application since you are not in a ‘profiling’ mode per se. Instruments records a lot more info and can know when objects are allocated/deallocated. It can let you know accurately if your application is leaking memory.
I’m not surprised that both Xcode and Instruments report the same high water mark.
In summary, Xcode gives you a live picture of your memory usage trend. Instruments allows you to deep dive to confirm if you are leaking memory or not.
Han Ming
On Dec 6, 2013, at 10:45 AM, Markus Spoettl <email@hidden> wrote:
> Hi,
>
> I'm trying to understand Xcode 5's memory utilization report pane. When I debug my iOS app (on the device), memory usage as reported by Xcode almost never goes down, while when using Instruments' Allocations instrument, mem usage goes up and down as objects are allocated or deallocated.
>
> Top mem usage is the same for both variants.
>
> Of course I expect differences (Xcode runs a debug version, Instruments runs the optimized release build), but Xcode makes it look as though I leak most of the allocated memory, where the leak instrument tells me everything is alright.
>
> Can I just ignore the memory pane in Xcode?
>
> I'm using Xcode 5.0.2.
>
> Regards
> Markus
> --
> __________________________________________
> Markus Spoettl
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden