Yet Another Simple Retain Count Question
Posted
by yar
on Stack Overflow
See other posts from Stack Overflow
or by yar
Published on 2010-05-25T19:48:59Z
Indexed on
2010/05/25
19:51 UTC
Read the original article
Hit count: 203
objective-c
|retaincount
[I'm sure this is not odd at all, but I need just a bit of help]
I have two retain
properties
@property (nonatomic, retain) NSArray *listContent;
@property (nonatomic, retain) NSArray *filteredListContent;
and in the viewDidLoad method I set the second equal to the first
self.filteredListContent = self.listContent;
and then on every search I do this
self.filteredListContent = [listContent filteredArrayUsingPredicate:predicate];
I thought I should do a release
right above this assignment -- since the property should cause an extra retain, right? -- but that causes the program to explode the second time I run the search method. The retain counts (without the extra release
) are 2 the first time I come into the search method, and 1 each subsequent time (which is what I expected).
Some guidance would help, thanks! Is it correct to not release?
© Stack Overflow or respective owner