Autorelease iPhone

前端 未结 6 569
遥遥无期
遥遥无期 2021-02-02 04:29

Coming up towards the end of developing an iPhone application and I\'m wondering just how bad is it to use autorelease when developing for the iphone. I\'m faced with some fairl

6条回答
  •  旧巷少年郎
    2021-02-02 05:23

    When you autorelease, you're basically saying: "I don't need this any longer, but anyone else is free to pick it up (before the auto release pool is drained)". When you explicitly relase an object you're saying: "I don't need this any longer and unless anyone else has already said otherwise (acquired), it should be deallocated immediately."

    Consequently, autorelease is not normally the wrong thing to. It is required when you want to pass objects back to the sender of a message without requiring the sender to take care of releasing the object.

提交回复
热议问题