HI I have a private api class for a indicator view as taken from the following link :
MBProgressHUD for iPhone | Bukovinski
Now on that I am startin an synchronous request and after getting the data I am showing an alertview .
But Immidiatelly after that I am getting a 16 bytes leak .. On each call to the function It is repeated..
The function code is :
Code:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/Service.asmx/insertFavourite?uid=2&restid=%@",[[NSUserDefaults standardUserDefaults] stringForKey:@"readOnly_key"],
[object.id stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
//[request setTimeoutInterval:10];
//NSURLResponse *response = nil;
// NSError *error = nil;
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
NSData *data1= [NSURLConnection sendSynchronousRequest:request
returningResponse:nil error:nil];
if(data1 == nil)
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Alert"
message:@"The network is not available.\n Please check the Internet connection."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
else
{
[favoritesButton setTitle:@"Remove" forState:UIControlStateNormal];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Confirmation"
message:@"Added To favorites"
delegate:nil
cancelButtonTitle:@"OKAY"
otherButtonTitles:nil];
[alert show];
//***************************************instruments shows leak here *************************
[alert release];
}
[request release];
In log I am gettin this :::
RestaurantApp(1802,0xb029a000) malloc: *** error for object 0x116c370: double free
*** set a breakpoint in malloc_error_break to debug
an the retain count of alert is getting 4 every time .. I haven't retained the alert object anywhere ????????????????
So what can be the possible reason . Is it something internal or my own ?