title: Memory usage grows with CTFontCreateWithName and CTFramesetterRef
body: <p>I'm writing an IOS program which uses custom fonts (CTFontManagerRegisterFontsForURL). I load the font, add it as a string attribute, create a framesetter, then a frame, and draw it to a context.
  I release everything i use. Instruments doesn't notice a leak but :</p>
  
  <p>The memory used by the applications grows and doesn't shrink when using this function.
  The retain count of my font is 2 when i leave the function.</p>
  
  <p>Here is the code :</p>
  
  <pre><code>CFMutableAttributedStringRef attributedStringRef = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
  CFAttributedStringBeginEditing(attributedStringRef);
  CFAttributedStringReplaceString(attributedStringRef, CFRangeMake(0, 0), (CFStringRef)label.text);
  
  font = CTFontCreateWithName((CFStringRef)label.fontName, label.fontHeight, NULL);
  </code></pre>
  
  <p>retain count of the font : 1</p>
  
  <pre><code>CFAttributedStringSetAttribute(attributedStringRef, CFRangeMake(0, label.text.length), kCTFontAttributeName, font);
  CFAttributedStringEndEditing(attributedStringRef);
  </code></pre>
  
  <p>retain count of the font : 2</p>
  
  <pre><code>CGMutablePathRef path = CGPathCreateMutable();
  CGPathAddRect(path, NULL, rect);
  
  CFRelease(font);
  </code></pre>
  
  <p>retain count of the font : 1</p>
  
  <pre><code>CTFramesetterRef frameSetter = CTFramesetterCreateWithAttributedString(attributedStringRef); 
  </code></pre>
  
  <p>retain count of the font : 3</p>
  
  <pre><code>CFRelease(attributedStringRef);
  CTFrameRef frame = CTFramesetterCreateFrame(frameSetter,
                                              CFRangeMake(0, 0),
                                              path, NULL);
  </code></pre>
  
  <p>retain count of the font : 5</p>
  
  <pre><code>CFRelease(frameSetter);
  </code></pre>
  
  <p>retain count of the font : 4</p>
  
  <pre><code>CTFrameDraw(frame, ctx);
  CFRelease(frame);
  </code></pre>
  
  <p>retain count of the font : 2</p>
  
  <pre><code>CGPathRelease(path);
  </code></pre>
  
  <p>Is there some sort of cache ? I really need to flush the memory used by this font immediately.</p>
  
  <p>P.S : I used CFGetRetainCount to get the retain count of the font.</p>
  
  <p>Thanks !</p>