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, 18 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:40 AM.

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

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