這段代碼給我一個100次迭代100次以上的泄漏。如果我寫[imageName發佈]它崩潰與「發送到釋放實例的消息」。我甚至不能想到什麼是問題的根源。奇怪的NSString泄漏
NSString* imageName=[NSString stringWithUTF8String:(const char*)sqlite3_column_text(statement, 5)];
imageName =[imageName stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
imageName =[imageName stringByReplacingOccurrencesOfString:@"." withString:@"-"];
[ret setQuestionImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageName ofType:@"jpg"]]];
「ret」從哪裏來?你有每個迭代新的?他們都呆在附近嗎?如果您保留100張JPEG圖像,則容易達到100 MB。 – Thilo 2012-07-30 10:17:40
ret是爲每次迭代動態創建的,我每次都釋放它 – 2012-07-30 10:19:41