problema de vazamento de memória usando NSData no iPhone
Problema de vazamento de memória - NSConcreteData
// to set tip - photo in photo frame
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:pathOfThumbNail]];
UIImage *cellThumbImg;
if([data length]>0){ cellThumbImg=[UIImage imageWithData:data];} else { cellThumbImg=[UIImage imageNamed:@"130X90.gif"]; }
UIImageView *imgView=[[UIImageView alloc]initWithImage:cellThumbImg]; imgView.frame=photoFrame;
(cellThumbImg.size.height>=58 || cellThumbImg.size.width>=58 ) ? [imgView setContentMode:UIViewContentModeScaleToFill] : [imgView setContentMode:UIViewContentModeCenter] ;
[cell.contentView addSubview:imgView];
[imgView release];
minha pergunta é muito parecida com essa pergunta,
iPhone - Memory Leak - NSData dataWithContentsOfUrl e UIWebView
Inclusive, eu adicionei o código a seguir ao meu aplicativo Finished Launching, fornecido abaixo. O código a seguir é para configurar a memória do sharedCache com capacidade zero. Ele quase removerá o vazamento de NSConcreteData no meu aplicativo. No entanto, a memória vaza.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
[sharedCache release];
[window makeKeyAndVisible];
}
Eu não consegui encontrar qualquer solução para esse tipo de pergunta do estouro de pilha.
Se você puder responder, eu serei grato a você.
Desde já, obrigado.