views:

40

answers:

1

Inside the function

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

I create an NSString, then give cell.textLabel.text the value of this string. Then I release it. The program will crash on getting one of the fields at the end.

If I don't release the NSString, then the program doesn't crash. But won't this create a memory leak?

+1  A: 

How are you creating the NSString? If it's anything other than an alloc followed by an init, you don't need to release it!

ennuikiller
Yeah I used alloc and init.
awakeFromNib