CTFontRef引起的内存泄漏

时间:2013-02-04 11:05:54

标签: ios memory memory-leaks ctfontref

我正在使用以下细节生成PDF,在仪器中我遇到内存泄漏,任何人都可以知道为什么仪器指向CTFontRef到100 perc泄漏。?

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 个答案:

答案 0 :(得分:1)

试试这个(假设ARC):

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