1

I currently have a big memory leak in my objective c program and I'm trying to find it and fix it (obviously!) The problem I'm running in to is that I created the program using ARC, so I can't just make my own implementation of release or something like that to see when or if an object is getting released.

To make matters worse, I'm not sure I entirely understand the allocations instrument. I've found that far too much memory is getting allocated and then not released by a mutable string that I believe is being created in a separate thread, but I don't know how to solve this problem! I thought that I'd destroyed all references to the object that contains it, but apparently not?

What is the best way to find where exactly the leak is? Or, if anyone has a fix, to fix it?

chicabella
  • 303
  • 1
  • 3
  • 8

2 Answers2

0

You can watch WWDC 2012 session titled "Learning Instruments" (Session 409). The videos are here.

Krokodylowy
  • 610
  • 6
  • 21
0

You can find when an object is gone by logging a message in his dealloc implementation. But if it's not deallocated you'd not get there to begin with.

You say references to the object that contains it and also separate thread. If you are using blocks to write the code that executes in the separate thread, watch out for a retain circle you may have created by referring to self in the block.

Edit:

In case you do not know what I'm talking about, check out Retain cycle on `self` with blocks and blocks, self, retain cycles

Community
  • 1
  • 1
Analog File
  • 5,280
  • 20
  • 23