Re: [NSString stringWithContentsOfURL:...], threads, and 10.5.4, xcode 3.1
Re: [NSString stringWithContentsOfURL:...], threads, and 10.5.4, xcode 3.1
- Subject: Re: [NSString stringWithContentsOfURL:...], threads, and 10.5.4, xcode 3.1
- From: "email@hidden" <email@hidden>
- Date: Tue, 22 Jul 2008 09:19:58 -0700
At 7:50 AM -0400 7/22/08, Kyle Sluder wrote:
On Mon, Jul 21, 2008 at 5:02 PM, email@hidden <email@hidden> wrote:
NSString* csvString = [NSString stringWithContentsOfURL: lookupURL
encoding: NSUTF8StringEncoding error: &lookupError];
This line right here requires an autorelease pool. Have you created
one for your thread?
It's apparent that you have a memory management issue somewhere in
your code. Can you post more context?
--Kyle Sluder
kyle,
thanx for the reply. yes, i do have an autorelease pool in place. i
agree that it looks like some kind of memory management problem. the
"bothersome" aspect is that this code used to work without any
problems. and yes, i know thread problems aren't always reproducible,
but the code has been in use problem free for sometime, probably
going back as far as 10.5.3 or earlier. but i can't figure out what
CFURL/NSURL is causing the problem. i'm not sure exactly what
additional code is worth posting. given (what i believe is the
relavent code):
NSURL* lookupURL = [[NSURL alloc] initWithString: urlLookupString];
NSError* lookupError = nil;
NSString* csvString = [NSString stringWithContentsOfURL:
lookupURL encoding: NSUTF8StringEncoding error: &lookupError];
...
[lookupURL release];
the error occurs during the processing of stringWithContentsOfURL; i
would assume that it would retain the passed in url as long as it
needs it; and i retain it (alloc init) before making the call and
don't release the url until after my call to stringWithContentsOfURL.
ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden