Help find memory leaks (general tips)

This is on iOS, an iPad device.

Here's what happens:

  • I launch the application on the device or debug it and launch using Xcode.
  • After 5 minutes, I get a warning about the memory level at level 1.
  • After a minute, I get a warning about the memory level at level 2.
  • After a minute, Program received signal: "0".

I checked the leaks with Leaks in Instruments and found no leaks . However, according to Activity Monitor, my application initially uses 30 MB, and over time it becomes more than 100 MB (about 200 KB per second!). Thus, it is obvious that leaks do not detect memory leaks.

So my question is: if leaks cannot detect it, are there general tips for finding them, and is there a better way to find these leaks?

+3
source share
3 answers

This is how I approach him

  • Name all classes with a prefix so that they can be easily seen in the Tools

  • Xcode-> Run-> Run with performance tool-> allocations

Now stop your application and enter the name of the class that you suspect is leaking in the search box. (here the prefix is ​​convenient). Launch tools again using the Record button

  • A live column should move up and down as objects are placed. Please note that if it does not fall, you have a leak.
+6
source

, , . , , . , . , , .

+1

, , , , .

, . , , .

0

Source: https://habr.com/ru/post/1786058/


All Articles