Ok the below problem is solved but now its creating leak for this block
NSMutableArray *tempRowArray=[[NSMutableArray alloc] init];
[tempRowArray addObject:[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)]];
[pickerList addObject:tempRowArray];
[tempRowArray release];
for tempRowArray
ahh I am lost in this memory problems.
Solved:
Hi,
Can you please help me in this, I have following condition
1) Declared an array in .h file.
2) Created property and synthesized it
3) In viewWillAppear allocated memory to it
pickerList = [[NSMutableArray alloc] init];
4) Read data from database and stored objects in this array
if (sqlite3_prepare(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
while (sqlite3_step(compiledStatement) == SQLITE_ROW) {
NSMutableArray *tempRowArray=[[NSMutableArray alloc] init];
[tempRowArray addObject:[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)]];
[pickerList addObject:tempRowArray];
[tempRowArray release];
}
}
picker list is shown as memory leak out there
and application eventually crashes after some time please help me get rid of it
5) I have released pickerList in dealloc() and set it to nil in viewDidUnload
Every time the view appears you allocate
pickerList. Allocate it inviewDidLoadand then release it inviewDidUnload.