what is difference between alloc and allocWithZone:?

前端 未结 6 1048
逝去的感伤
逝去的感伤 2020-12-12 15:07

From forum discussion , seem like that the big difference is performance factor, allocWithZone: will alloc memory from particular memory area, which reduce cost of swapping.

6条回答
  •  臣服心动
    2020-12-12 15:48

    I use allocWithZone in singleton. As Forrest mentioned, the variables created allocated from the same region of memory. Thus other classes can use or access them from the same zone of memory. Save memory space when you run your app.

提交回复
热议问题