0
votes

Im using the following code to populate a nsmutablearray

_unique = [NSMutableArray array];
for (id obj in statusDateArray) {
    if (![_unique containsObject:obj]) {
        [_unique addObject:obj];
    }
}

But im getting the following error sometimes.

malloc: * error for object 0x15d86b120: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug

why am I getting this error and how can i sort this out?

1
It might be crashing in that code, but there is nothing wrong with it. I'm guessing you have a weak pointer involved somewhere... Have you done what the error message mentioned? - Droppy
i have not used weak pointers in my .h or .m file - user6517192

1 Answers

0
votes

I think you set the property as weak or you have deallocate it or free it. (Check it out)