• 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: String memory leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String memory leak


  • Subject: Re: String memory leak
  • From: "Chris Lewis" <email@hidden>
  • Date: Mon, 3 Apr 2006 01:51:48 +0100

Hi Paul,
You're right, I had gotten myself confuzzled on a lack of sleep and
abortive Red Bull kickstart. I suck. My apologies everyone.

When I was a newbie (rather than my current inept semi-newbie status)
I wasn't really sure the deal with Cocoa array retainment strategys.
As part of the Cocoa framework methodology, they work entirely as you
would think. If you don't entirely see that methodology through yet,
they can appear a little tricksy.

It seems strange that this:

SomeObject *object = [[SomeObject alloc] init];
[array addObject:object];
[object release]; // container now "owns" object we are done with

is valid. I would have seen this as the array having a pointer to an
object I just happily released, and now have no guarentee of it's
existance. But yes, the array retains the object for itself until it's
removed or the array itself is released.

Of course, this is all valid and totally correct and expected
behaviour. It's just a little new if you have thought of arrays with
objects in soley as a way of storing a lot of object pointers at once.

Chris
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >String memory leak (From: Bruce Truax <email@hidden>)
 >Re: String memory leak (From: "Chris Lewis" <email@hidden>)
 >Re: String memory leak (From: Paul Forgey <email@hidden>)

  • Prev by Date: Re: String memory leak
  • Next by Date: repositioning NSSplitView divider with NSWindow windowDidResize:
  • Previous by thread: Re: String memory leak
  • Next by thread: Re: String memory leak
  • Index(es):
    • Date
    • Thread