Finding all references to an object instance in Obj-C

后端 未结 3 2088
盖世英雄少女心
盖世英雄少女心 2021-02-13 18:55

I\'m trying to track down some bugs, and one of them is related to a memory leak. It\'s an object that I can tell that something still has a reference to, since Instruments stil

3条回答
  •  甜味超标
    2021-02-13 19:36

    I would recommend using the Allocations/ObjectAllocations Instruments template and then in the top right corner type the class name of your object (in the Category field).

    You can then see the allocations increasing as you suggest and by viewing the extended detail you can see where they were allocated.

    All content below this point was added by the OP (joshbuhler)

    In the screenshot below, change the filter to "Objects List", and then by clicking on the little arrow to the right of the object's address, the history of memory events (alloc/retain/release/dealloc) will be show for that object. It won't show you exactly what is hanging onto that object, but it will give you some very useful info for tracking it down.

    enter image description here

提交回复
热议问题