Memory Leak due to CTFontRef

381 views Asked by At

I am generating a PDF using the below detail , in Instrument i am getting memory leak, can any one have idea why the instruments point to the CTFontRef to 100 perc leak.?

NSMutableAttributedString *string = [[[NSMutableAttributedString alloc]
                                                 initWithString:textToDraw] autorelease];   
CTFontRef helveticaBold = CTFontCreateWithName(CFSTR("Helvetica-Bold"), 8.0, NULL);

[string addAttribute:(id)kCTFontAttributeName
                       value:(id)helveticaBold
                       range:NSMakeRange(0, [string length])];
1

There are 1 answers

1
Robbie Hanson On

Try this (assuming ARC):

[string addAttribute:(NSString *)kCTFontAttributeName
               value:CFBridgingRelease(helveticaBold)
               range:NSMakeRange(0, [string length])];