i have some questions why my memory consume always increase when present new page but after dismiss not reduce the memory and there are not memory leaks detects for example :
- when first run : first run image
- when present new page: new page image memory consume
- when dismiss the page: dismiss page image memory consume
i look at Debug memory graph, the Foundation always increase . like this:
- first run: Debug memory graph image first
- present new page: Debug memory graph image present new page
- dismiss page: Debug memory graph image dismiss page
as you can see the Foundation always increase the Heap. so the question why always increase and how we release them ? so the consume memory not increase
- example code: https://github.com/tomdwipo/simpleMemory
CodePudding user response:
I checkout your code from Github and I found its a default behaviour in apple iOS. when we call new screen that time memory get allocated into main memory and when we dismiss screen then its memory objects remain into memory until some other screens or object require memory. This memory management done by apple iOS to get best performance and avoid repetitive memory allocation task. We can't say this is related to memory leak because in memory leak problem iOS can't deallocate memory object when more memory required by other objects.