Sheehan Alam
Sheehan Alam

Reputation: 60919

Do properties need to be deallocated?

I subclassed NSObject:

#import <Foundation/Foundation.h>


@interface STObject : NSObject {
    NSString *message_type;
    NSString *twitter_in_reply_to_screen_name;
}

@property(nonatomic, copy) NSString *message_type;
@property(nonatomic, copy) NSString *twitter_in_reply_to_screen_name;

@end

My implementation looks like:

#import "STObject.h"

@implementation STObject
@synthesize message_type, twitter_in_reply_to_screen_name;

@end

Do I need to create a dealloc method for my two properties where I release the strings?

Upvotes: 1

Views: 136

Answers (1)

kennytm
kennytm

Reputation: 523734

Yes. The the properties won't be automatically -release'd with @synthesize.

-(void)dealloc {
   [message_type release];
   [twitter_in_reply_to_screen_name release];
   [super dealloc];
}

Upvotes: 4

Related Questions