what is difference between alloc and allocWithZone:?

前端 未结 6 1053
逝去的感伤
逝去的感伤 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:44

    In the Foundation Functions Reference, all of the Zone functions are now prefaced with the below warning that Zones will be ignored.

    Zones are ignored on iOS and 64-bit runtime on OS X. You should not use zones in current development.

    NSCreateZone
    NSRecycleZone
    NSSetZoneName
    NSZoneCalloc
    NSZoneFree
    NSZoneFromPointer
    NSZoneMalloc
    NSZoneName
    NSZoneRealloc
    NSDefaultMallocZone
    

提交回复
热议问题