object not getting released in iphone
Posted
by Jaimin
on Stack Overflow
See other posts from Stack Overflow
or by Jaimin
Published on 2010-05-28T07:43:25Z
Indexed on
2010/05/28
7:51 UTC
Read the original article
Hit count: 200
iphone
|memory-leaks
i m writing this code in my code to store the data in database..
Search *objSearchDetail = [[Search alloc] init];
objSearchDetail = [xmlResponseDetail objectAtIndex:i];
sql = "INSERT INTO tblsearchdetail(tblrecentsearch_id,name,address,email,url,street,postcode,city,telephone,mobile) VALUES(?,?,?,?,?,?,?,?,?,?)";
returnValue = sqlite3_prepare_v2(database, sql, -1, &insertStatement, NULL);
if(returnValue == SQLITE_OK){
sqlite3_bind_int(insertStatement, 1, intLastRecentSearchId);
sqlite3_bind_text(insertStatement, 2, [objSearchDetail.strName UTF8String], -1,SQLITE_TRANSIENT);
sqlite3_bind_text(insertStatement, 3, [objSearchDetail.strAddress UTF8String], -1,SQLITE_TRANSIENT);
sqlite3_bind_text(insertStatement, 4, [objSearchDetail.strEmail UTF8String], -1,SQLITE_TRANSIENT);
sqlite3_bind_text(insertStatement, 5, [objSearchDetail.strUrl UTF8String], -1,SQLITE_TRANSIENT);
sqlite3_bind_text(insertStatement, 6, [objSearchDetail.strStreet UTF8String], -1,SQLITE_TRANSIENT);
sqlite3_bind_text(insertStatement, 7, [objSearchDetail.strPostCode UTF8String], -1,SQLITE_TRANSIENT);
sqlite3_bind_text(insertStatement, 8, [objSearchDetail.strPlace UTF8String], -1,SQLITE_TRANSIENT);
sqlite3_bind_text(insertStatement, 9, [objSearchDetail.strTelephone UTF8String], -1,SQLITE_TRANSIENT);
sqlite3_bind_text(insertStatement, 10, [objSearchDetail.strMobile UTF8String], -1,SQLITE_TRANSIENT);
if(sqlite3_step(insertStatement)==SQLITE_DONE)
{
//Data;
}
}
NSLog(@"count %d",[objSearchDetail retainCount]);
[objSearchDetail release];
now the nslog shows refrence count as 2 so even if i release the refrence count will still be one and the object will not be destroyed.. plz help me....
© Stack Overflow or respective owner