News for hackers. Stuff that matters.
Re:Finding iOS Memory Leaks with Xcode's Instruments by gregdoesit on Monday January 25, 2016 @04:48PM (#10970198)
This article does a great job explaining the several not really documented steps of finding memory leaks using XCode.

I do wish the XCode developers would have implemented a more intuitive UI to do the same - e.g. taking inspiration from Chrome Developer Tools, or Visual Studio.

<rant> Actually, I would just be happy if XCode had the debugging features that Visual Studio 2005 (10 years ago) had. Like inspecting variables values with mouse over on breakpoints. Or when right clicking "refactor" in XCode on a method name, being able to refactor Swift code. 1 year after the release of Swift the error dialog "XCode can only refactor Objective C code" appears - so much for supporting the Apple's own language. </rant>

Anyway, article bookmarked - because even after reading this, there's no way I would remember all the steps needed to debug those memory leaks!

Re:Finding iOS Memory Leaks with Xcode's Instruments by derwildemomo on Monday January 25, 2016 @05:01PM (#10970292)
> 7 simple and not really documented steps of finding memory leaks using XCode

There's actually event a "Leaks" template in the instruments app, I wondered why the author didn't use that. And that tool is even documented by apple, see

https://developer.apple.com/library/ios/documentation/Develo...

Re:Finding iOS Memory Leaks with Xcode's Instruments by bestows on Monday January 25, 2016 @05:40PM (#10970570)
> It’s worth noting that the Leaks instrument can also be useful, but it is primarily used to detect memory that is never freed, not memory leaks from retain cycles.

The author does mention it.

For what it's worth, I can't see what gregdoesit quoted in the article.

Re:Finding iOS Memory Leaks with Xcode's Instruments by mikeash on Monday January 25, 2016 @10:50PM (#10971724)
That makes no sense. Retain cycles are one potential cause of memory that is never freed, and the Leaks instrument picks them up fine.

Where it fails is when memory is not freed because it's still referenced somewhere from your live objects, but shouldn't be. For example, if you keep adding subviews to a view and don't use the old ones anymore, expecting them to be destroyed but forgetting to remove them from their superview first.

Basically, Leaks is a garbage collector minus the collector, and where it fails is exactly where garbage collectors can fail and still allow leaks. Like any sensible garbage collector, it can handle cycles just fine.

(I know you just quoted it, but I thought this was a good place to address this weird aspect of the article.)

Re:Finding iOS Memory Leaks with Xcode's Instruments by gregdoesit on Monday January 25, 2016 @06:09PM (#10970714)
Fair point. The quote was my from the author, but my interpretation, apologies for the confusion. I've updated my comment to remove the misleading quotes.
Re:Finding iOS Memory Leaks with Xcode's Instruments by cmsj on Monday January 25, 2016 @05:36PM (#10970545)
The author states their reason
Re:Finding iOS Memory Leaks with Xcode's Instruments by coralreef on Monday January 25, 2016 @04:59PM (#10970278)
Like inspecting variables values with mouse over on breakpoints

Pretty sure you can do this already

Re:Finding iOS Memory Leaks with Xcode's Instruments by gregdoesit on Monday January 25, 2016 @05:31PM (#10970509)
You would hope so. Unfortunately not if you are running swift as of XCode 7.2, the latest public release. For Objective C it works.
Re:Finding iOS Memory Leaks with Xcode's Instruments by waynecochran on Monday January 25, 2016 @05:39PM (#10970564)
I am using Swift + Xcode 7.2 and mouse over works fine w debugger.

Alas, refactoring tool still does not work for Swift (this tells me Apple engineers must still be using Obj-C).

Re:Finding iOS Memory Leaks with Xcode's Instruments by gregdoesit on Monday January 25, 2016 @06:12PM (#10970732)
You're right: it doesn't work when hovering over "self". I am just used to other IDEs handling all cases, self variables included.

Yes, agreement on some Swift love needed from the refactor tool team.