NSNumber memory leak for iphone

I have a memory leak, and I have no idea where it came from or how to fix it.

At some point, I compute the distance between two points.

double calc = [self getDistance:location to:otherLocation];
NSNumber *distance = [NSNumber numberWithDouble:calc];

in tools I get as a missing object NSCFNumber and it identifies

NSNumber *distance = [NSNumber numberWithDouble:calc];

like a string calling this.

I'm at a loss. Please, help.

thanks in advance, Michel

+3
source share
3 answers

There is nothing wrong with what you do there. NSNumberhas a save account of +0 (auto-implemented), so you probably save it NSNumberelsewhere and forget to free it.

+8
source

, , , .

, - , - , , !

+3

, NSNumber.

,

code>double calc = 10.1234567;
    NSNumber *distance = [NSNumber numberWithDouble:calc];

    NSLog(@"calc: %f | %f", calc, [distance doubleValue]);

, "getDistance: to:"

, . , .

,
VFN

-1

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


All Articles