Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fritzables

macrumors regular
Original poster
May 6, 2011
149
1
Brisbane AUSTRALIA
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
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
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

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.
 

thundersteele

macrumors 68030
Oct 19, 2011
2,984
9
Switzerland
You're missing an opening bracket. I suspect you're thinking of ARC or Automated Reference Counting. Here's a link to the documentation.

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.