When profiling the SimpleEKDemo application from Apple I note there are some memory leaks.
One of the leaks is __NSArrayM which has 3 lines in the Leaked Blocks history, a Malloc/Assign/Release.
Question – can someone point out the root cause issue here? (I’m trying learn how to take Instruments output of where a leaky object was created, and then from there work out root cause, so this would be really useful)
You will notice that when you run the demo with leaks that there is a leak in
viewDidLoad(responsible frame). If you switch toCall Treedetail and if you have enabledInvert Call Tree, you will see a leak associated with the call+[NSArray new]. If you open that a bit, you will seeinitWithArraywhich is called in theRootViewController‘sviewDidLoad. The problem bit is,eventsListis aretained property so the object created has a retain count of 2. However it is onlyreleased once either through thereleaseindeallocor through reassignment ofeventsList. YOu will have to autorelease this object.Once fixed, you shouldn’t get any errors.