Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Large Memory Leak Using Reachability

Using Instruments on the device it detects a 3.50 KB memory leak using Apple's Reachability 2.0 code in my app. The Leaked Object is GeneralBlock-3584. The leaks tool points to the following code:

- (BOOL) startNotifer
{
    BOOL retVal = NO;
    SCNetworkReachabilityContext    context = {0, self, NULL, NULL, NULL};
    if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
    {
        // THIS IS LINE OF CODE WHERE THE LEAK OCCURS:
        if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
        {
            retVal = YES;
        }
    }
    return retVal;
}

I'm pretty much using the Reachability example straight from the Apple example code so I can't figure out why this is happening or how I fix it.

like image 425
Lauren Quantrell Avatar asked Jun 16 '10 15:06

Lauren Quantrell


1 Answers

GeneralBlock-3584 leaks are, according to official Apple statements on the developer forums (check http://devforums.apple.com, and mind your NDAs), not a real leak and in fact a bug in Instruments.

like image 55
Jonathan Grynspan Avatar answered Oct 06 '22 01:10

Jonathan Grynspan