我正在使用以下详细信息生成 PDF,在 Instrument 中我遇到内存泄漏,任何人都可以知道为什么仪器指向 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])];
最佳答案
试试这个(假设是 ARC):
[string addAttribute:(NSString *)kCTFontAttributeName
value:CFBridgingRelease(helveticaBold)
range:NSMakeRange(0, [string length])];
关于ios - CTFontRef 导致内存泄漏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14685410/