• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: After Autoreleasing Still Getting Leaked
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: After Autoreleasing Still Getting Leaked


  • Subject: Re: After Autoreleasing Still Getting Leaked
  • From: Scott Ribe <email@hidden>
  • Date: Wed, 15 Jun 2011 15:20:25 -0600

On Jun 15, 2011, at 2:30 PM, Jens Alfke wrote:

> On Jun 15, 2011, at 1:26 PM, Bing Li wrote:
>
>> Actually, I attempt to design P2P system using Cocoa. Meanwhile, the peer on Mac OS X must communicate with some Java systems. So I need to use sockets and transmit XML.
>
> Sorry to be blunt, but it’s clear from this answer (and others) that you’re not reading the suggestions people are giving you. All you responded to here was one minor question at the end of Conrad’s message, not the numbered list of five major issues.

Not 100% sure, but I believe he may already have been told that he doesn't need to use low-level sockets just because he's communicating with Java...

Anyway, to Bing, my last advice:

- You have to follow proper memory management everywhere, not just where you're originally allocating objects. As has been pointed out to you multiple times now, your leak is not coming in the code snippet you posted. It's happening elsewhere, in code that uses the return value, so that's what you have to look at, what the consumers of that returned value do with it.

- Given that you had two stack-smashing bugs in one small snippet of C, and other oddities in the code, I think you really need to read a basic introductory text on C.

- You also don't seem to really understand how sockets work. Perhaps I'm wrong here, and your receivedMessage method does everything it would need to do in terms of assembling message fragments, if only you weren't potentially messing up strings because of boundary issues before you ever called it. (In other words, if you just appended to NSData or some such until you had a whole message.) But from the overall sense of your code and your questions, I really doubt it. So an introductory text on network programming is also in order (Stevens is the classic on this subject). Or you could use higher-level network APIs, to which I believe you were referred a long time ago: CFSocket, maybe NSURL depending on the structure of the messages you're exchanging with Java.


--
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

  • Follow-Ups:
    • Re: After Autoreleasing Still Getting Leaked
      • From: Tony Romano <email@hidden>
References: 
 >After Autoreleasing Still Getting Leaked (From: Bing Li <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Scott Ribe <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Bing Li <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Scott Ribe <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Jens Alfke <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Scott Ribe <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Bing Li <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Scott Ribe <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Bing Li <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Jens Alfke <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Bing Li <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Conrad Shultz <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Bing Li <email@hidden>)
 >Re: After Autoreleasing Still Getting Leaked (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Interface item validation through first responder
  • Next by Date: Re: iOS: encoding a custom view with a shape in it
  • Previous by thread: Re: After Autoreleasing Still Getting Leaked
  • Next by thread: Re: After Autoreleasing Still Getting Leaked
  • Index(es):
    • Date
    • Thread