I am looking to create a system which on signup will create a subdomain on my website for the users account area.
Cisco Certified Network Associate Exam,640-802 CCNA All Answers ~100/100. Daily update
Cisco Certified Network Associate Exam,640-802 CCNA All Answers ~100/100. Daily update
I used to verify that same of my variable haves the expected retain count using some [myVar retainCount] under the debugger, especially for var that did not have a custom dealloc.
How do you do this in Arc mode? How do you ensure that there is no memory leak?
You should never use retainCount for anything, with or without ARC.
ReplyDeleteWhen to use -retainCount?
You don't. ARC handles the memory management for you and does not allow you to call retainCount and even if you could see it, the number it returns is meaningless for you. If you want to you should be doing memory profiling in Instruments with the Leaks and Allocations instruments. That is the best way to look and see how your application is allocating memory and catch any improper use of memory there.
ReplyDeleteYou don't. Apple say you don't need to as ARC will handle it for you.
ReplyDeleteI believe the only way is to profile your application using the Allocations instrument. You will need to click on the info descriptor (the 'i' next to Allocation in the left pane) and click on "Record Reference Counts". You can then profile your app and do a search for the specific class you're looking to inspect. From there you can find the retain count in the Extended Detail pane for each instance of the class.
ReplyDeleteYou can also do this using Leaks as well (since I believe it's a variation of the Allocations instrument).