Memory continuously increase then app crash when i display image from document directory during scrolling UITableview

后端 未结 3 1540
臣服心动
臣服心动 2021-01-19 15:18

My Requirement is download all images in application memory and display it from local if its available.

Below is my code to access image from local and if its not av

3条回答
  •  情话喂你
    2021-01-19 16:08

    As per my Understanding there is an issue in your "getSavedImage" Method you have to manage memory Manually instead of 'autorelease' so as My suggestion is use

    UIImage *image = [[UIImage alloc] initWithContentsOfFile:filePath]
    and also release it after use of it. means after '[self setImage:saveImg];'
    [saveImg release]
    

    instead of this.

    [[UIImage imageWithContentsOfFile:filePath] retain];
    

    'Don't Use Autorelease because it has staying in memory until pool not drain' and just because of this you got an memory issue.

提交回复
热议问题