Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 15, 2008, 04:14 AM   #1
sujithkrishnan
macrumors 6502
 
Join Date: May 2008
Location: Bangalore
Send a message via Yahoo to sujithkrishnan
What leak in following lines ?

Hi,

I am attaching the screenshot of the INSTRUMENTS mem-leak stach trace.
When i go to the line mentioned in INSTRUMENTS, i found leak is in the following lines....


INSTRUMENTS Showing REALLOC in this line... ( I am calling this line many times in file, but i am not using any explicit alloc for any of variable)
This line is in a method and method returns me the NSData it recieved from URL, when i pass the URL to it...
Code:
-(NSData *)httpConnectionHandler:(NSString *)URL  xmlString:(NSMutableString *)xmlDataInStringForm
{
	
	
	NSString *URLString = [NSString stringWithFormat:@"http://stage.digby.com/30ss/%@?%@",URL,xmlDataInStringForm];
	
	URLString = [URLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];	
	
	NSMutableURLRequest *orderRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:URLString]];
	[orderRequest addValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
	[orderRequest setHTTPMethod:@"GET"];
	
	NSURLResponse *orderResponse=nil;
	NSError *orderResponseError=nil;
	
	NSData *recievedOrderData = [NSURLConnection sendSynchronousRequest:orderRequest returningResponse:&orderResponse error:&orderResponseError];
		
	return recievedOrderData;
	

}
Another leak is showing in this line
Code:
// praserObject is a property...
parserObject = [[NSXMLParser alloc] initWithData:receivedData1];
(I think in following line, the previous string is losing its reference, when we oveerwrite with new string...)
Code:

URLString = [URLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];	
But what wrong woth following?????????
Instruments showing
Code:
BOOL success = [NSKeyedArchiver archiveRootObject:[CustomerInfo getCustomerObject] toFile:writableDBPath];
Code:
if([[itemObject.iImg substringToIndex:4] isEqualToString:@"http"])
	 {
		 //NSAutoreleasePool *poolObj = [[NSAutoreleasePool alloc]init];
		 
		 NSURL *urlString = [[NSURL alloc]initWithString:itemObject.imgName];
		 NSData *data  = [[NSData alloc]initWithContentsOfURL:urlString];
		 UIImage *img = [[UIImage alloc]initWithData:data];
		 cell.image = img; 
		 [img release];
		 [data release];
		 [urlString release];     //[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:itemObject.iImg]]];
		
		 //[poolObj drain];
	}
	else
	{ 
		 cell.image = [UIImage imageNamed:itemObject.iImg];
	}
	     state = 1;
	}			 
	
	return cell;
Attached Thumbnails
Click image for larger version

Name:	Picture 1.png
Views:	58
Size:	311.9 KB
ID:	124649  

Last edited by sujithkrishnan; Jul 15, 2008 at 04:43 AM.
sujithkrishnan is offline   0 Reply With Quote
Old Dec 13, 2008, 12:39 AM   #2
mpramodjain
macrumors regular
 
Join Date: Nov 2008
Location: Banglore
Remote and Local Server

Hi all,

May I know what is the server you are using , Remote server or local server.
I found a strange behaviours for the http connection using NSURL.

a) When I am using the remote server,
I am not getting any memory leak.
b) When I am using the local server
i) with IP Address in the url, I am didnt got any memory leak.
ii) with Domain name(eg: http://somelocalserver/test1.xml) I am getting the memory leaks.

So If u find any issue related to this or any solution for the part b. or reasons for this behaviour please reply.

Thank u.
mpramodjain is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
I have leak in my APP 01.vipin iPhone/iPad Programming 5 Mar 9, 2011 08:22 AM
Use Mac Pro Line In as Line Out? ventro Mac Pro 4 Jan 3, 2009 10:10 PM
Why instruments showing leak in "ODD" lines? sujithkrishnan Mac Programming 1 Jul 9, 2008 10:33 AM
What are these vertical lines in my screen!!! OMG bebetc MacBook Pro 21 Jun 24, 2008 04:34 AM
Parallells Question...Hard to describe what i mean in 1 line. Wallace86 Mac Basics and Help 2 Jan 30, 2008 11:55 AM


All times are GMT -5. The time now is 03:52 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC