My app is running good and looks ok. But after I ran it with Instruments, I found tons of leaks on it. There are several things seems not wrong like a code below. Is the code really have problems? Any single word will be helpful to me.

1 Answer
1

Some operations may cause the frameworks to store static data structures that are never released. For instance, the implementation of -initWithContentsOfFile: may set up some internal settings the first time it's used which are then in place until the app is terminated, possibly for performance optimization reasons. This is not a real leak, but leak detection software will sometimes flag it as such. There's also the possibility that the framework itself has a bug that causes a memory leak but this is rare, especially for a well-established class like NSDictionary.

You're not leaking in your code, it's correct as far as I can tell. If your -dealloc method is being called (add a log statement to be sure) then you are fulfilling your part of the contract and any leak is not your fault.

It's probably worth using the ObjectAlloc instrument as this gives you a much better idea of what objects are allocated and are hanging around.