Subscribe ( )

iPhone Programming Tutorials

 

Forum

You must be logged in to post Login Register

Search 

Releasing variables

User Post

2:26 pm
October 21, 2008


AdeC

iCoder

posts 17

1

Can you give some advice on releasing objects…

In the 2nd part of your sqlite tutorial there is some code as follows

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"todo.sqlite"];

Should we not be releasing *paths, *documentsDirectory and *path ??

Could you explain why not if not?


Thanks

2:01 pm
October 29, 2008


Brandon

Admin

brandontreb

posts 87

2

After you are done using path your should release it.  I just didn't because I was lazy.  If it does not need to be used again, it should be released.  This is to save memory and make your application run more smoothly.  Hope that helps….


About the iCodeBlog forum

Currently Online:

5 Guests

Maximum Online: 25

Forums:

Groups: 2

Forums: 6

Topics: 194

Posts: 585

Members:

There are 356 members

There are 1 guests


Brandon has made 87 posts

Top Posters:

bobcubsfan - 52

crazyiez - 30

VertigoSol - 26

AdeC - 17

Uhu - 17

Administrator: Brandon | Moderators: VertigoSol


© - Version 3.1.4 (Build 357)