Setting an object nil versus release+realloc

前端 未结 6 992
隐瞒了意图╮
隐瞒了意图╮ 2021-02-15 01:34

This is not a garbage collected environment

I have a class instance variable which at some point in my runtime, I need to re-initialize with a different data set than it

6条回答
  •  余生分开走
    2021-02-15 02:05

    If you do myArr=nil; by itself, then you've lost the pointer to which you can send the release message to. There is no magic to release your object.

    And, as Georg says, without being able to release your object, that memory has 'leaked'.

提交回复
热议问题