How to detect leaks of UIKit objects?

- (void)btnInboxPressed
{
    for (int j = 0; j < 100000; j++) {
        [[UIButton alloc] init];
    }
}

Why it will not be displayed as memory leak in tools? If I also distribute NSMutableString, the tools block a memory leak.

enter image description here

+3
source share
1 answer

Perhaps this is because there is something that still points to each button; still has an accessible link to each instance of the button.

A “leak” is an object (or distribution) for which it is not possible for the program to refer to it again. The address of the specified object is no longer displayed in the program.

However, there are many ways in which you can share the memory without considering it a leak.

- - . , , - . - , .

, ; " ! , 10 000 UIButtons!?!?!? , !"


, . , UIButton / - .

, , .

+3

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


All Articles