Re: [newbie] NSString code so it won't leak
Re: [newbie] NSString code so it won't leak
- Subject: Re: [newbie] NSString code so it won't leak
- From: James DiPalma <email@hidden>
- Date: Thu, 12 Sep 2002 13:01:19 -0400
Funny, after Jim's "Buddy, your code isn't leaking
everyone in the world had told you this and you choose
to ignore this so your a bone-head"
That is a mis characterization of my post. You continue to show a
disregard for my help.
My characterization of your posts is this: you whined for a day or two
that no one would download your actual code when in fact about a half
dozen had done so and publicly stated that your use of NSString's code
was not in error. You also showed reluctance to removing your extra
release messages that were causing your program to crash; you figured it
was ObjectAlloc crashing your code and there where a few leaks, so why
not ignore Apple's memory management policy when you have some memory
leaking.
My post was trying to get your attention diverted from releasing
everything in site (and doing so against my recommendation which you
asked for). By focusing our attention away from NSString and away from
extra releases, Shawn was able to find out why your application (and not
your code) was waiting a long time to release those strings.
"Everyone in the world" was trying to convince you that maybe you should
look outside of NSString for why you had residual objects.
What did I get? The standard, go read the books and
the web sites. The memory management rules are so easy
a monkey with half a brain could figure them out.
You complained that Cocoa was too confusing to understand when and how
to use retain/release/autorelease. And I defended Cocoa and its
documentation and everyone who has spent considerable time adding to
that documentation with Web examples, articles and books. I never stated
that you where a bone-head and I never implied that you where less than
a monkey with half a brain. What I did say is that this list can confuse
some issues and that I'm not surprised that you are confused, but that
we are all fortunate to have numerous sources of good clear
documentation to look at; I didn't even state that you should have read
these docs, just that they were available.
And despite all this attitude about how you knew better all along, your
code still had this method in it:
- (void)URLHandleResourceDidFinishLoading:(NSURLHandle *)sender
{
NSData *filedata = [sender resourceData];
[self extractWith
Data:filedata];
filedata release];
[sender removeClient:self];
[sender release];
NSLog(@"URLHRDFL");
}
And you want to complain about getting a reference to documentation when
you so clearly release objects you shouldn't? sender was passed in to
your method and you don't own filedata. Its no surprise that your
application crashed in [NSURLHandle flushCachedData]; must be
ObjectAlloc and not the fact that you released both that NSURLHandle and
its cached data. Your direct response to these facts?
if I don't free "sender" in
URLHandleResourceDidFinishLoading objects of type
CFHTPPURLHandle (or something like that) and a bunch
of what looked to be NSURL releated objects would
start to stack up (one object for each time the timer
would fire).
So I responded with: Wake Up! yeah, I thought I needed to be a bit more
forceful, because when I said, "lets start with obeying ownership
rules," and you responded, "oh no, I have objects leaking and they need
to be released." At which point I should have just shut up and let you
figure it out without my help, but I didn't I'm too stupid to keep my
mouth shut when someone asks for help.
-jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.