uso do @Memory aumenta com CTFontCreateWithName e CTFramesetterRef
Estou escrevendo um programa IOS que usa fontes personalizadas (CTFontManagerRegisterFontsForURL). Carrego a fonte, adiciono-a como um atributo string, crio um framesetter, depois um quadro e o desenho para um contexto. Eu libero tudo o que eu uso. Os instrumentos não percebem um vazamento, mas:
A memória usada pelos aplicativos aumenta e não diminui ao usar esta função. A contagem de retenção da minha fonte é 2 quando deixo a funçã
Aqui está o código:
CFMutableAttributedStringRef attributedStringRef = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
CFAttributedStringBeginEditing(attributedStringRef);
CFAttributedStringReplaceString(attributedStringRef, CFRangeMake(0, 0), (CFStringRef)label.text);
font = CTFontCreateWithName((CFStringRef)label.fontName, label.fontHeight, NULL);
retain contagem da fonte: 1
CFAttributedStringSetAttribute(attributedStringRef, CFRangeMake(0, label.text.length), kCTFontAttributeName, font);
CFAttributedStringEndEditing(attributedStringRef);
retain contagem da fonte: 2
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, NULL, rect);
CFRelease(font);
retain contagem da fonte: 1
CTFramesetterRef frameSetter = CTFramesetterCreateWithAttributedString(attributedStringRef);
retain contagem da fonte: 3
CFRelease(attributedStringRef);
CTFrameRef frame = CTFramesetterCreateFrame(frameSetter,
CFRangeMake(0, 0),
path, NULL);
retain contagem da fonte: 5
CFRelease(frameSetter);
retain contagem da fonte: 4
CTFrameDraw(frame, ctx);
CFRelease(frame);
retain contagem da fonte: 2
CGPathRelease(path);
Existe algum tipo de cache? Eu realmente preciso liberar a memória usada por essa fonte imediatament
P.S: usei CFGetRetainCount para obter a contagem de retenção da font
Obrigado