views:

31

answers:

2

I did a very simple test which was creating a blank project using xCode and execute on device. When executed with Instruments I got memory leaks !

Please note that I am using iPhone 3G device running iOS 4.0.2

Here are the steps to reproduce:

  1. From xCode 3.2.3 Choose File -> New Project -> Navigation-based Application selecting Use Core Data for storage
  2. Choose Device - 4.0 as the build Target
  3. Choose Run -> Run with performance tool -> Leaks
  4. On the iPhone 3G device (running iOS 4.0.2) click the '+' button several times in the launched App.

Here is the Instruments screenshot: alt text

Can anyone confirm this issue?

Thanks, Joshua

A: 

Cocoa has always had very small leaks in it, and it occasionally has things that look like leaks and aren't really. When looking for leaks, what you are looking for are leaks that grow over time. Seeing a single leak report like this of a few kB is not a cause for concern. If you're running this on the empty template project from Apple, you should open a radar (bugreport.apple.com), since it means that there either is a small but common leak in Cocoa or Instruments is wrong. In either case, it should be fixed, but it's not something to lose sleep over.

Rob Napier
A: 

It looks like you're getting leaks related to WebKit (WebCore, JavaScriptCore, etc.). I had the exact same leaks in a few of my projects with iOS 4.0, but the apps still got approved by Apple (because the leaks are not your fault).

The good news? I recently tested these same apps with the 4.1 SDK, and all of my WebKit-related leaks are gone! Since you are using 4.0 I suggest you try the 4.1 SDK to see if they've disappeared.

Shaggy Frog
It's good to know 4.1 solved your leaks! What devices you tested when you got the leaks with 4.0 ?
Joshua
@Joshua iPod Touch 1st Gen running 3.1.3; iPhone 3GS running 4.0.2; iPad running 3.2.2
Shaggy Frog