0

I'm working on a note app that has a collection view of notes, and taping each cell will lead the user to different note. In the case of my app, each note is essentially a PKCavnasView that inherent from ScrollView.

What I found is that when user navigate back to collection view and select a new cell, the memory used by the previous note is not released. So as user navigate between different notes, the memory usage will soar up.

What's more of a problem is that when the app goes to the background, all the memory is still not released.

What I'm wondering is that, will the navigation controller automatically release the memory of each tap to different cell? If not, is the autorelease pool the solution here? If so, where should I put the autorelease pool.

enter image description here

Legolas Wang
  • 1,951
  • 1
  • 13
  • 26
  • 2
    There is no way to help without code. Use the memory debugger to help find reference cycles. In Swift, if two objects hold strong references to each other, they won’t be released. – Lou Franco Mar 14 '20 at 10:28
  • https://medium.com/@stevenpcurtis.sc/memory-leaks-using-the-xcode-memory-graph-debugger-60de23bab3aa – Lou Franco Mar 14 '20 at 10:29

0 Answers0