I have a question about ARC nad NSMutableArray.
Here's the case:
I have a ListView with a NSMUtableArray (arr1
) that contains all the elements of the listview. A separate thread, which runs in native code, makes callbacks into objective-c ListView. The native code creates a new NSMutableArray (arr2
), fills it with elements of my custom class (each element has a name, id, icon etc), then passes it onto the ListView.
In the ListView, first I clear the array with [arr1 removeAllObjects]
, then I add each element from arr2
to arr1
with [arr1 addObject: ..]
.
NOTES:
*All the code, both native and objective-c, is compiled as Objective-C++ code.
*The native code part that allocs and init's arr2
(and all its elements) and calls the ListView stuff is all under @autoreleasepool
directive
My questions;
Is there any memory leaks from native code?
Is there any memory leaks from ListView code? Will the old elements I release with
[arr1 removeAllObjects]
cause memory leaks?Does @autoreleasepool provide the same functionality as ARC, meaning I wont have to explicitly release the objects?