在工具中使用分配工具时,您可以在 3 个分配生命周期之间进行选择。前两个似乎很明显:
“创建所有对象” - 每个对象
“创造与依然存在”——记忆中的每一个物体
第三个怎么样:“创造与毁灭”?
这是:
1) 在选定的时间跨度内被销毁并在选定的时间跨度内创建的每个对象
或
2) 自运行开始以来创建的选定时间跨度内被销毁的每个对象(无论选定的时间跨度如何)
仪器指南实际上并未给出任何这些选项的行为。我认为这是猜测 1,但想知道是否有人确切知道。
When using the Allocations instrument in Instruments, you can choose between 3 Allocations Lifespans. The first 2 seem obvious:
"All Objects Created" - Every object
"Created & Still Living" - Every object still in memory
What about the third one: "Created & Destroyed"?
Is this:
1) Every object that was destroyed during the selected timespan AND created during the selected timespan
OR
2) Every object that was destroyed during the selected timespan created since the beginning of the run (regardless of the selected timespan)
The Instruments guide doesn't actually give the behavior of any of these options. I assume it is guess 1, but wonder if anybody knows for sure.
发布评论
评论(1)
您可以通过从跳转栏中选择“调用树”来查看分配寿命的差异。 “使用的字节数”列说明了以下公式:
创建的所有对象 =(创建和仍然存在)+(创建和销毁)
根据我的观察,Instruments 在创建和销毁的生命周期中具有行为 #2。 Instruments 显示被销毁的对象,并且对象何时创建并不重要。
You can see the differences in the allocation lifespans by choosing Call Trees from the jump bar. The Bytes Used column illustrates the following formula:
All Objects Created = (Created and Still Living) + (Created and Destroyed)
From what I've seen, Instruments has behavior #2 for the Created and Destroyed lifespan. Instruments shows the objects that were destroyed, and it doesn't matter when the objects were created.