views:

25

answers:

1

Whenever I first create a CTFont object it consumes about 10 MB of real memory.

 CTFontRef font = CTFontCreateWithName(CFSTR("Helvetica"), fontSize, NULL);
 CFRelease(font);

After calling CFRelease the memory consumption doesn't change so I'm assuming that some sort of font cache is built and stored. How can I make it consume less memory?

I am concerned because the rest of my application which does a lot of things only weighs 2 MB and the little bit that produces text output takes up 5 times as much. And no, I can't use other text output methods.

A: 

I don't think you should bother about this issue. Calling CFRelease is pretty-much okay and about what you can do. 10MB is not too much. If you have this problem, probably all CoreText apps have it. You could file a bug for it and see what they respond. Maybe it loads the whole font database that is then cached somewhere for better performance. I think there's nothing you can do then. File a bug if you want to know more details.

Max Seelemann