views:

103

answers:

1

Does anybody know if the iPhone maintains a cache of previously used font characters?

Recently, while trying to uncover a memory leak near a UITextField controler, I've noticed that the leaks are almost (95%) gone whenever I start writing text that uses only characters from previous attempts.

What seems to happen is that for every displayed character from a font, the system stores it in memory the first time it's displayed and reuses it when it's repeated.

However I couldn't find any posts/articles on the Internet about this behaviour.

A: 

UIKit caches fonts at the metadata and glyph level to prevent parsing font data repeatedly. It should use an insignificant amount of memory relative to the rest of your application though (unless you attempt to draw every glyph from every font)

rpetrich