我遇到了一个有问题的泄漏 - 感谢 Instruments - 似乎来自 CTFrameSetterCreateWithAttributedString。调用堆栈如下。
1 CoreText -[_CTNativeGlyphStorage prepareWithCapacity:preallocated:]
2 CoreText -[_CTNativeGlyphStorage initWithCount:]
3 CoreText +[_CTNativeGlyphStorage newWithCount:]
4 CoreText TTypesetterAttrString::Initialize(__CFAttributedString const*)
5 CoreText TTypesetterAttrString::TTypesetterAttrString(__CFAttributedString const*)
6 CoreText TFramesetterAttrString::TFramesetterAttrString(__CFAttributedString const*)
7 CoreText CTFramesetterCreateWithAttributedString
生成此调用堆栈的代码是:
CFAttributedStringRef attrRef = (CFAttributedStringRef)self.attributedString;
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(attrRef);
CFRelease(attrRef);
...
CFRelease(framesetter);
self.attributedString 在其他地方发布。我觉得我正确地发布了其他所有内容......鉴于这一切,泄漏可能来自哪里?这对我的目的来说相当重要——每次 6-10 MB。谢谢你的帮助。