Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old Nov 20, 2012, 09:54 PM   #1
quanganhct
macrumors member
 
Join Date: Dec 2010
Objective C - retain release problem

Hello there,

I have some problems concerned retain, release problem. I understand well what those 2 do. But, when I write some code, a really funny situation appear. Actually I write 2 little projects to try out these methods, one run normally

Code:
2012-11-21 10:44:25.472 RetainRelease[1352:a0f] init:retain count of 1
2012-11-21 10:44:25.475 RetainRelease[1352:a0f] Count : 2
2012-11-21 10:44:25.476 RetainRelease[1352:a0f] Count : 1
2012-11-21 10:44:25.476 RetainRelease[1352:a0f] dealloc called. Delete
And one project acted funny.

On the first line where I create an object, init is called and print out retain count, which is :

Code:
2012-11-21 10:34:51.691 HelloObjC[1274:a0f] init: Retain count of 57568
2012-11-21 10:34:51.694 HelloObjC[1274:a0f] Count : 57568
2012-11-21 10:34:51.694 HelloObjC[1274:a0f] Count : 57568
2012-11-21 10:34:51.695 HelloObjC[1274:a0f] Count : 57568
2012-11-21 10:34:51.695 HelloObjC[1274:a0f] Count : 57568
2012-11-21 10:34:51.696 HelloObjC[1274:a0f] Count : 57568
2012-11-21 10:34:51.696 HelloObjC[1274:a0f] Count : 57568
2012-11-21 10:34:51.697 HelloObjC[1274:a0f] Count : 57568
2012-11-21 10:34:51.697 HelloObjC[1274:a0f] Count : 57568
I dont understand why it run like that. Retain count didnt even decrease when release method was called.

I attached my code below, so please check it out.
Attached Files
File Type: zip HelloObjC.zip (2.20 MB, 27 views)
quanganhct is offline   0 Reply With Quote

 
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
how to retain unlimited? T4R06 iPhone 4 Jan 8, 2013 07:31 PM
Problem in detect CGRect - objective-c nxcoder iPhone/iPad Programming 0 Dec 31, 2012 10:15 AM
retain UIColor IDMah iPhone/iPad Programming 11 Aug 21, 2012 03:18 PM
Retain the crispy! JMEANS Apple TV and Home Theater 7 Jul 10, 2012 03:53 PM
Circular release problem with NSTimer... ArtOfWarfare iPhone/iPad Programming 3 Jun 11, 2012 07:04 PM

Forum Jump

All times are GMT -5. The time now is 06:49 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC