Re: After Autoreleasing Still Getting Leaked
Re: After Autoreleasing Still Getting Leaked
- Subject: Re: After Autoreleasing Still Getting Leaked
- From: Bing Li <email@hidden>
- Date: Thu, 16 Jun 2011 04:26:10 +0800
Dear Conrad,
I appreciate so much for your suggestions!
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.
Best regards,
Bing
On Thu, Jun 16, 2011 at 4:10 AM, Conrad Shultz <
email@hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 6/15/11 12:50 PM, Bing Li wrote:
> > Jens,
> >
> > Thanks so much for your suggestions!
> >
> > I wonder why it works fine according to Activity Monitor if such a huge
> leak
> > exists. The consumed memory in the Activity Monitor is stable and much
> > smaller unless some threads are created at a high concurrent moment.
> After
> > the threads are dead, the consumed memory becomes stable and small. I
> feel
> > weird for this.
>
> Honestly, I feel like you are not listening to the excellent responses
> people are giving you.
>
> 1) Activity Monitor is not a profiling tool. Don't use it as such. Use
> Leaks/Allocations, maybe with some heapshot analysis thrown in as I
> believe I mentioned a while back.
>
> 2) Analyze your code with the Clang static analyzer ("Build & Analyze").
> This will shake out many common memory issues (and more).
>
> 3) Recognize that posting snippets of the code that you THINK might be
> responsible for a leak does not mean that people on the list can
> actually help you find it. For example, even if you are doing
> everything completely properly inside a function, if that function
> returns some object, the calling code can still leak that object.
>
> 4) It seems as if much of your code is multi-threaded. All else being
> equal, this makes such problems even harder to debug. If I were having
> such serious issues, I would probably spend some time trying to get the
> task to work on the main thread and only once that is thoroughly
> debugged would I break it up across threads. (This won't work for every
> type of problem, but if it can work for you, I'd do it.)
>
> 5) As others have commented, there is substantial evidence that your
> code probably has issues other than memory management. If you are, for
> example, smashing the stack in your C code, all bets are off and you
> really need to fix that first.
>
> It's been so long since you first started posting that I've forgotten
> what you are trying to do. You are communicating in a high level format
> (XML), yet all your code seems to concern very low level network
> behaviors (opening sockets, reading bytes, et cetera). I wonder whether
> you are over-engineering all this. What is your goal?
>
> - --
> Conrad Shultz
>
> Synthetiq Solutions
> www.synthetiqsolutions.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iD8DBQFN+RG8aOlrz5+0JdURAjRNAJ9YCKwfHbB6iICdmKARupttOoJkMQCdG5TT
> ZAaJuogqgVGHjKxS4sqA8pw=
> =RkC+
> -----END PGP SIGNATURE-----
>
_______________________________________________
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