TouchJson memory leak?

291 views Asked by At

I'm using TouchJson to parse json data from facebooks graph api. I'm getting some memory leaks though, and I don't really understand why...

In my effort to find the leak, I've removed everything else, so the following code is what I'm left with. The leak is one NSCFString for each loop, and I understand that it comes from the assignement to myItem.date, but I don't understand why?

I'm using the latest version of TouchJson

NSError *error;
NSDictionary *jsonDictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:data error:&error];
NSArray *jsonArray = [jsonDictionary objectForKey:@"data"];

for (NSDictionary *jsonEntry in jsonArray) {
    NSDictionary *fromDictionary = [jsonEntry objectForKey:@"from"];
    NSString *userId = [fromDictionary objectForKey:@"id"];

    // Continue if it is a post from Atlas
    if (userId != nil && [userId isEqualToString:@"10465958627"]){
        MyItem *myItem = [[MyItem alloc] init];

        // This uncommented causes the leak, why?
        myItem.date = [jsonEntry objectForKey:@"created_time"];

        [myItem release];
    }
}

Thank you for your help!

Edit: I forgot to mention that MyItem is just an object with a property like so

@property (nonatomic, copy) NSString *date;
0

There are 0 answers