i thought i getting the hang of Cocoa memory management, but apperently i have a lot more to learn.
Take a look at this class i wrote:
Word.h
#import <UIKit/UIKit.h>
@interface Word : NSObject {
    NSString *word;
    NSMutableArray *wordArray;
}
@property (nonatomic ,retain) NSString *word;
@property (nonatomic ,retain) NSMutableArray *wordArray;
@end
Word.m
#import "Word.h"
@implementation Word
@synthesize word, wordArray;
- (void)setWord:(NSString *)aWord {
    NSMutableArray *newValue = [[NSMutableArray alloc] init];
    self.wordArray = newValue;
    [newValue release];
    for (int i = 0 ;i < [aWord length] ;i++) {
        NSString *character = [[NSString alloc] init];
        character = [NSString stringWithFormat:@"%C",[aWord characterAtIndex:i]];
        [wordArray addObject:character];
        //[character release];
    }
}
- (void)dealloc {
    [word release];
    [wordArray release];
    [super dealloc];
}
@end
As you can see i'm filling an array when i'm setting the string. I'm dong this in a for loop by pulling out the char of the string and putting them in a new allocated string. Then i put that string in the array and then i have to release the string. And it's here i do it wrong, because i'm releasing the value i'm putting in to the array. when later i'm trying to use the array, its gone.
How should i go about this? it feels wrong to make "character" a property and releasing it in dealloc because its just temporary.
 
     
     
    