What is the cost of using autorelease in Cocoa?

前端 未结 11 1551
眼角桃花
眼角桃花 2020-11-30 08:19

Most of Apples documentation seems to avoid using autoreleased objects especially when creating gui views, but I want to know what the cost of using autoreleased objects is?

11条回答
  •  猫巷女王i
    2020-11-30 08:45

    One side note to keep in mind is if you are spawning a new thread, you must setup a new Autorelease pool on that thread before you do anything else. Even if you are not using autorelease objects, chances are that something in the Cocoa APIs is.

提交回复
热议问题