[NSString release] in XCode 4.2??

Discussion in 'Mac Programming' started by Fritzables, Mar 23, 2012.

  1. macrumors regular

    Joined:
    May 6, 2011
    Location:
    Brisbane AUSTRALIA
    #1
    Hi All,

    I have heard a rumor that XCode 4 does a better job of Memory Management compared to former versions.

    If I declare a string like:

    Code:
    NSString *aString = [NSString alloc] init];
    do I still need to:

    Code:
    [aString release];
    or will it be looked after by XCode4 ??

    Pete
     
  2. macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
    #2
    You're missing an opening bracket. I suspect you're thinking of ARC or Automated Reference Counting. Here's a link to the documentation.
     
  3. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #3
    Read the documentation for ARC. The compiler will do lots of things for you if you ask it to, but you still need to know how memory management works.
     
  4. macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #4
    This. Read the ARC documentation.

    A few notes: If you activate ARC for an existing project, you have to remove all retain/release calls in the ObjC parts of the Code. Otherwise the compiler will complain.

    You will need to understand "strong" and "weak" properties - this is something I stumbled upon.
     

Share This Page