How do you find out what is retaining an object in Instruments?

前端 未结 1 950
南旧
南旧 2021-02-05 12:38

I\'ve recently converted my iOS project over to ARC. One of the view controllers is not calling its dealloc method and is not being dealloc\'ed according to Instruments.

相关标签:
1条回答
  • 2021-02-05 13:07

    Well if you are really stuck and the program is complex (or abstracted, in the case of ARC), you can bring out the cannons:

    • Open your Xcode project
    • Choose the executable (if needed)
    • Press cmd+i (Profile)
    • Choose the 'Leaks' Instrument in Le Wizard (if needed)
    • Press Return to begin profiling
    • Exercise your app
    • Press 'Stop' in Instruments
    • Verify the 'Allocations' instrument is selected
    • Click and Hold the Popup Button named 'Statistics'
    • Select the Objects List item
    • Locate the allocation you are interested in, among the records in the Objects List
    • Select that allocation/object
    • Click the 'detail arrow' to the right of the address in the table view cell of that allocation
    • Now you see all events related to the allocation (allocation, free, reference count operations)
    • Press cmd+shift+e for Extended Detail
    • Go through the events in this list, and locate the imbalance you seek.
    0 讨论(0)
提交回复
热议问题