We're working on a project and are using ARC. When using the xcode instruments we found several memory leaks while connecting and sending data to Game Center. We also tested the code from this tutorial: www.raywenderlich.com , and it also leaked at the same places. Shouldn't ARC prevent these leaks?
Asked
Active
Viewed 176 times
0
-
1Can we get specific lines of leaks? I'd rather not have to search through Ray's entire site to get your point. – CodaFi Jan 31 '13 at 14:07
1 Answers
0
One of the reasons why there is a memory leak although ARC is used is the following:
If an autorelease object is created, e.g. by a class function like [NSMUtableArray array]
, this object is put into the current autorelease pool, which will release it later when no other owner exists and the autorelease pool is drained.
If however no autorelease pool exists, which is the case if a new thread is generated without an explicit @autoreleasepool {...}
as one of the first statements, the object cannot be released later, since no autorelease pool can be drained, an the object is a memory leak.

Reinhard Männer
- 14,022
- 5
- 54
- 116