How to release memory created from CFStringTokenizerCreate?
        Posted  
        
            by Boon
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Boon
        
        
        
        Published on 2009-10-26T19:27:56Z
        Indexed on 
            2010/05/23
            0:00 UTC
        
        
        Read the original article
        Hit count: 407
        
iphone-sdk
|core-foundation
I use CFRelease to release the CFStringTokenizerRef obtained from CFStringTokenizerCreate call. But instruments is reporting memory leak at around this area. Am I missing something?
  CFStringTokenizerRef tokenRef = CFStringTokenizerCreate(NULL, 
                                   (CFStringRef)contents, 
                                   CFRangeMake(0, contents.length),
                                   kCFStringTokenizerUnitWordBoundary, 
                                   NULL);
  CFStringTokenizerTokenType tokenType;
  // leak reported here
  while ((tokenType = CFStringTokenizerAdvanceToNextToken(tokenRef)) != kCFStringTokenizerTokenNone) 
}
CFRelease(tokenRef);
        © Stack Overflow or respective owner