2

I was curious to know what the real importance of realeasing objects is, and when it should be done. Also, when you change scene, does it automatically release everything, or are they still in the memory?

Thanks

akuritsu
  • 440
  • 1
  • 4
  • 18
  • If that's the kind of question you'd wish you'd rather not need to know about, then by all means start using ARC (automatic reference counting). See my blog for more info: http://www.learn-cocos2d.com/tag/automatic-reference-counting/ – CodeSmile Apr 19 '12 at 10:29
  • @LearnCocos2D Thanks, im wathing the video right now, but I was wondering if ARC is the best solution for all situations. Are there any situations where it would not be wanted? – akuritsu Apr 19 '12 at 10:50

3 Answers3

5

Well that depends, you should only release object that you own. You own object that you create via alloc, copy, mutableCopy or new. Releasing them when you don't need them any more is always a good idea.

You should start by reading the memory management documentation apple provides.

But if you are using ARC than there is no need for you to release object, since this is determent at compile time.

rckoenes
  • 69,092
  • 8
  • 134
  • 166
0

The CCScene on changing will automatically release only it's childs, i mean CCNode subclasses, that you added to it. If you retained any object by code, you must release it in dealloc method

Morion
  • 10,495
  • 1
  • 24
  • 33
0

well i am new to objective c but 1 thing i would like to mention is that why bother about allocation or release or retain when apple has provided such an awesome feature called ARC. ARC itself takes care of the memory management issues. so in my opinion all those developers out der jus do d coding n leave d rest to ARC.

taus-iDeveloper
  • 681
  • 2
  • 8
  • 22
  • 2
    @akuritsu: for more in-depth info on ARC or any other thing u can always google it out. since dis is not a site where v are supposed to give tutorials. BTW since you have asked for more info i will direct you to a tutorial. follow the below link to understand how ARC functions. http://longweekendmobile.com/2011/09/07/objc-automatic-reference-counting-in-xcode-explained/ – taus-iDeveloper Apr 19 '12 at 09:39