Re: How to Management Bytes?
Re: How to Management Bytes?
- Subject: Re: How to Management Bytes?
- From: Scott Ribe <email@hidden>
- Date: Sun, 19 Jun 2011 10:13:13 -0600
On Jun 19, 2011, at 9:28 AM, Bing Li wrote:
> One more issue is that there was no memory leaking even if I didn't add the
> line, free(receivedBytes). Why?
Because it's stack-allocated, not allocated with any version of malloc. I pointed out the same mistake in my first email to you, yet here you are about a week later having re-introduced the error. Read an introductory book on C. Now. Before you waste any more of your time.
What is the purpose of subLoopPool? There is now nothing in its scope that will cause any objective-C objects to be created, much less autoreleased.
And that copy thing you tried... Seriously? Allocating a a string you own, then copying (& leaking) it, then autoreleasing the copy???
You're just thrashing here, going back and forth between the same set of mistakes with no understanding of what's going on. AS YOU WERE TOLD MULTIPLE TIMES BY MULTIPLE PEOPLE, you had the memory management correct in this function, and were leaking the receivedMessage string elsewhere in your code. Yet here you are days later, still thrashing around with random weird pointless buggy changes to this function.
I had intended not to respond to any more of these messages, but I decided to try one more time. I am now done. I will not try to help you again until you ask a question that demonstrates that you have listened to what you've been told about where your bug is, and have "done your homework" by getting some fundamental understanding of the language you're trying to use.
(And by the way, you are probably nowhere near having a stable program. Based on what you've shown us so far, you should be prepared to be debugging for a while.)
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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