Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Instruments: Leaks by Trevor Brown

Instruments: Leaks by Trevor Brown

Trevor discusses using the leaks tool in Instruments from CocoaHeads September in Durham

Triangle Cocoa

September 27, 2012

More Decks by Triangle Cocoa

Other Decks in Programming


  1. INSTRUMENTS: LEAKS Trevor Brown Triangle CocoaHeads September 2012

  2. What are leaks? How can we detect them? How can

    we prevent them? Q&A Resources
  3. Memory that... has been consumed (allocated), is no longer needed,

    but cannot be returned to the OS for reuse or accessed by the program that allocated it. Is there a problem with that? Waste of resources Slowdown (unresponsive) Unexpected shutdown by OS WHAT ARE LEAKS? (and why they’re bad)
  4. HOW CAN WE DETECT LEAKS? Static Analyzer (Xcode) Instruments Code

  5. Launch your app with the profiler

  6. None
  7. None
  8. None
  9. None
  10. None
  11. Random audience member: “Thanks for the total waste of time,

    Trevor. I use ARC. Like, all the time. Wow... Um, beer, anyone?”

  13. Object A Object B RETAIN CYCLE

  14. None
  15. LEAK PREVENTION Use ARC (convert) Avoid retain cycles (no strong-strong

    relationships) Handle low-memory warnings from the OS Run the static analyzer

  17. RESOURCES Performing static code analysis Instruments User Guide ARC transition

  18. THANK YOU!