With UILabel, larger font size results in more memory usage. I have keyboard extension with emoji keyboard which shows around ~50 emojis in one screen. With font size of 25, when scrolling through emojis, the memory usage climbs up to ~250mb but with font size of 10, it goes only up to ~70mb. Before emoji keyboard is shown, it starts around 40mb so the memory usage delta for font size 25 is ~230mb and for font size 10 is ~30mb.
This is really bad because keyboard extensions have limit of 75mb by Apple and it'll crash once it goes over 75mb. I searched a bit and it seems like UILabel stores bitmap in memory which seems to explain the large memory usage for larger font size. Is there way to avoid the memory usage problem for UILabels for large font size?
I made sure there are no memory leaks and made as simple as possible by only adding single UILabel to UICollectionViewCell, always used dequeue method to reuse the cell and checked that cells get deinitialized. I'd like to solve the core problem of reducing the memory usage by UILabel by preventing caching or some other methods so that I can continue using large fonts.