NSString *hostStr2 = [[NSString alloc] initWithFormat:@"http://%@/getplaylist.php?ip=%@",yourip,restip];
NSLog(@"XMLAppDelegate checkstatusthread call to php for status,playlist and nowplaying XML's %@" ,hostStr2);
NSData *dataURL2 =[NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr2 ]];
[hostStr2 release];
NSString *playlistdata=[[NSString alloc] initWithData:dataURL2 encoding:NSASCIIStringEncoding];
NSArray *ipItemsArray;
// memory leak showing at below line
ipItemsArray =[playlistdata componentsSeparatedByString:@"|^|"];
[playlistdata release];
What I am storing in ipItemsArray is a big XML data separated with a delimiter '|^|'. The problem is when i run this it is giving memory leaks in this array. Is there any other type of array that we can use or can someone better optimize this code so that i can get rid of the memory leaks happening.
最好将内存分配给该数组。然后在dealloc方法中释放它
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.