Problems with memory management, autorelease, permanent heap is sometimes 250+ kb on iOS

前端 未结 2 1605
生来不讨喜
生来不讨喜 2021-01-25 08:03

I\'m really pulling my hair out on this one, it seems that I\'m having severe issues with memory management on an iOS app.

Here\'s the case: first I load table. When the

相关标签:
2条回答
  • 2021-01-25 08:24

    Are you using imageNamed to load your images - this method will keep all images cached in memory. Try initWithContentsOfFile instead.

    Watch out though; initWithContentsOfFile: won't cache at all so if you use this method a lot for the same image then you should be using imageNamed:!

    0 讨论(0)
  • 2021-01-25 08:27

    I think you might want to try to optimize your design first and read guides for efficent memory management. A better understaning of the components and the runtime helps more than tracking memory allocations and will make it easier to find the leaks.

    • First you should always use release. Only use autorelease when necessary.
    • Make sure you follow the guidelines for UITableView implementations and efficient management of UITableViewCells (lazy loading, cell reusing etc.).
    • Check if you have retain-cycles (retained view controllers won't be deallocated).
    • Track the deallocation of your view controllers and objects
    • Don't keep stuff in memory you don't need anymore.
    • Don't load stuff you don't need right now.
    0 讨论(0)
提交回复
热议问题