• 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: retain, copy, release, autorelease...leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: retain, copy, release, autorelease...leak


  • Subject: Re: retain, copy, release, autorelease...leak
  • From: email@hidden
  • Date: Thu, 28 Jun 2001 16:32:36 -0400

> myArray = [[NSMutableArray arrayWithCapacity: 10] retain];

You do not need to retain or release objects created with class methods (arrayWithCapacity: is a class method for NS*Array), only those created with [[... alloc] init*:] methods.

>NSColor *colorStore;
>colorStore = [self Quicky];
>//[colorStore release];

You crash when you call autorelease because you haven't actually created (allocated, initialized, retained) an NSColor object. You need to create it with a method like [NSColor redColor] or [[NSColor alloc] init*]. I think you're getting memory leaks 'cause you're putting pointers to objects that don't exist into myArray.


-- Robert Lee Dotson

"If we aren't supposed to eat animals, why are they made of meat?"


  • Prev by Date: SSH clients on other platforms was: Re: MacOSX-dev digest, Vol 1 #904 - 22 msgs
  • Next by Date: Re: AppKit source available as reference?
  • Previous by thread: Re: retain, copy, release, autorelease...leak
  • Next by thread: Re: retain, copy, release, autorelease...leak
  • Index(es):
    • Date
    • Thread