Solved - Memory issue debugging

Hi,

I worked late last night trying to track down why something in my code is being released before another release happens causing an error. The problem is I can’t track down which object it is. It fails in the Ref class. Is there a way to debug what is being retained/released?

Are you handling the release of objects yourself manually, or are the objects being destroyed “too early” by the autorelease pool?

You can check the contents of the autorelease pool with the contains function for debugging. Or alternatively, you could retain the object manually with “object->retain()” and then release/autorelease your object later.

As far as I know, objects will only be autoreleased after their “reference count” reaches 0, which means that the object is no longer in use anywhere. You can check their number with “object->getReferenceCount()”.

This article explains how everything works in better detail.

Hope this helps!

This thread fixed my problem :grinning: