CFNetworkCopyProxiesForAutoConfigurationScript
is Apple's native API, defined in CFNetwork framework.Whenever I call this API many memory leaks are left by this API and they keep on piling with each call to this API.I found it using "Instruments" and "View Memory Graph Heirarchy" option too. At the end it crashes due to memory issues.
Below is the sample code that I am running.
CFErrorRef err = NULL;
NSString *strURL = @"http://www.google.com";
CFStringRef tempPacdata = CFStringCreateCopy(kCFAllocatorDefault, (__bridge CFStringRef)pacFileData);
CFURLRef tempURLref = CFURLCreateWithString(kCFAllocatorDefault, (__bridge CFStringRef)strURL, nil);
CFArrayRef proxies = CFNetworkCopyProxiesForAutoConfigurationScript(tempPacdata, tempURLref, &err);
strURL = nil;
if (proxies != NULL)
{
CFRelease(proxies);
proxies = NULL;
}
if (tempPacdata != NULL)
{
CFRelease(tempPacdata);
tempPacdata = NULL;
}
if (tempURLref != NULL)
{
CFRelease(tempURLref);
tempURLref = NULL;
}
Here is the screenshot from Memory Graph
Has anyone else facing this issue and got any remedy for this?Any random thoughts are welcome too.