Can Xcode be configured to reference counting for me?

I would like to know if Xcode can be configured to do reference counting and show warnings if the "keep" and "free" numbers don't match?

+2


a source to share


2 answers


Use Build> Build and Analyze or cmd-shift-A. A static analyzer can catch many bugs in this area.



+11


a source


What are tools for? Tools.

For more saves than releases:

The leaks will tell you when you no longer have an object reference, but it still retains.



Object Alloc will show you all the objects that are still persisting on the system at any given time. Don't forget that a lot of things shouldn't be released until your program finishes ... so the system can't know when you have too many delays, except in the event of a leak. Allocating an object can also show you a complete history of save and release calls for any object.

If you have more releases than saved, you will know immediately because the app will crash. In this case, you enable "NSZombieEnabled" by selecting your Get Info executable and then on the General tab enter the "NSZombieEnabled" environment variable to "YES". Then when you try to access the object you issued, you will see an error in the log. He can also help a lot get Object Alloc running and tell him to pay attention to Zombies. Don't shy away from detecting zombies, although it works without ever releasing memory.

+5


a source







All Articles