Xcode是報告上的代碼中的特定行中的內存泄漏:的NSMutableArray存儲器泄漏
(NSArray*)myFunction{
NSMutableArray * tempMapListings=[[NSMutableArray alloc] init]; //Xcode says leak is here
//do a bunch of stuff to insert objects into this mutable array
return tempMapListings;
[tempMapListings release]; // but I release it ?!
}
這是由於釋放作爲一個NSArray一個可變數組?由於mutable從無法繼承,我不認爲這是一個問題,並且無論如何,該對象被釋放。我會很感激第二隻眼睛的建議。
「這是因爲NSArray是一個可變數組嗎?」 - 你是什麼意思?問題不在這裏,而是與該功能有關。你可以發佈所有使用該功能的代碼嗎?你能不能準確地展示你對這個陣列做了什麼? – darksky