0
我寫了一個fetchAllFromDatabase從我的db中獲取數據。 的代碼是:從sqlite中獲取數據時發生內存泄漏
if ([tableName isEqualToString:kFavouriteStoresList]) {
NSMutableDictionary *dictFavStoreDetails = [[NSMutableDictionary alloc] init];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,0)] forKey:kFavouriteStoresList_ZipCode];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,1)] forKey:kFavouriteStoresList_StoreNumber]; // Leaking Memory
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,2)] forKey:kFavouriteStoresList_Address]; // memory leak
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,3)] forKey:kFavouriteStoresList_StoreName];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,4)] forKey:kFavouriteStoresList_City];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,5)] forKey:kFavouriteStoresList_State];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,6)] forKey:kFavouriteStoresList_Phone]; // Memory leak
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,7)] forKey:kFavouriteStoresList_Latitude];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,8)] forKey:kFavouriteStoresList_Longitude];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,9)] forKey:kFavouriteStoresList_sHrsMonToThu];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,10)] forKey:kFavouriteStoresList_sHrsFri];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,11)] forKey:kFavouriteStoresList_sHrsSat];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,12)] forKey:kFavouriteStoresList_sHrsSun];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,13)] forKey:kFavouriteStoresList_pHrsMonToThu];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,14)] forKey:kFavouriteStoresList_pHrsFri];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,15)] forKey:kFavouriteStoresList_pHrsSat];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,16)] forKey:kFavouriteStoresList_pHrsSun];
[dictFavStoreDetails setObject:[NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatement,17)] forKey:kFavouriteStoresList_StoreServicesList];
[tempFetchArray addObject:dictFavStoreDetails];
[dictFavStoreDetails release];
dictFavStoreDetails = nil;
}
在這裏,我對3個系得到一個內存泄漏(見在此定義3行的內存泄漏的評論)。誰能告訴我爲什麼會發生這種情況