Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Mac OS X Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-22-2009, 02:59 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 148
rraagg is on a distinguished road
Default Why does my NSString object not return RetainCount as 1

Evening all,

Why does my NSString object not return RetainCount as 1:

NSString *test;
test = @"test";
NSLog(@" retain count is %d", [test retainCount]);

This prints

retain count is 2147483647

Shouldn't retain count be 1 as test is a string object?

Anyone got any ideas why this is happened.
rraagg is offline   Reply With Quote
Old 08-22-2009, 03:53 PM   #2 (permalink)
Coder for Life
 
Karl Kraft's Avatar
 
Join Date: Sep 2008
Location: Austin, TX
Posts: 76
Karl Kraft is on a distinguished road
Send a message via AIM to Karl Kraft
Default

Quote:
Originally Posted by rraagg View Post
Evening all,

Shouldn't retain count be 1 as test is a string object?
Because constant non-mutable strings are a special case. The string can never be deallocated because it isn't in the heap.

Karl Kraft Blog Archive Don’t use non mutable objects to understand leak detection
Karl Kraft is offline   Reply With Quote
Old 08-22-2009, 05:39 PM   #3 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 148
rraagg is on a distinguished road
Default

oh right, ok cheers.
rraagg is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 465
14 members and 451 guests
alexeir, David-T, Dj_kades, foslock, iAppDeveloper, jeroenkeij, Mijator, myach, pipposanta, QuantumDoja, robsmy, sacha1996, SLIC, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,129
Posts: 402,928
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:29 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0