iOS : ARC, not freeing memory

前端 未结 3 1856
夕颜
夕颜 2021-01-24 13:47

I\'ve kind of a weird issue with my iOS app. after a while my app goes low in memory so memory warning, everything seems to be fine, but when I check the memory usage I noticed

3条回答
  •  执笔经年
    2021-01-24 14:21

    Vassily,

    First, if you aren't yourself releasing extra memory, the the -didReceiveMemory warning does you no good and the OS will keep asking for memory until you are killed. This sounds like it is your problem.

    Second, if that isn't the problem then you are probably getting terminated due to the size of your resident memory partitions. Make sure you look at your VM allocation in Instruments. I expect the MALLOC_TINY or MALLOC_SMALL both have greater than 5 MB resident and dirty footprints. Due to the nature of small allocations these VM regions will never shrink. The only option you really have is to not create a lot of small items in the first place. This is really only something you can address by changing you code's algorithms to use less memory.

    Andrew

提交回复
热议问题