servo / font-kit

A cross-platform font loading library written in Rust
Apache License 2.0
678 stars 100 forks source link

Revert "Fix `select_best_match` leaks memory on Mac" #184

Closed kaiwk closed 1 year ago

kaiwk commented 3 years ago

This reverts commit ec11b73c4801444dd3eabe9d334ec644d66fc5b3.

Sorry, but I think I made a mistake, actually the memory leaking was caused by https://github.com/servo/core-foundation-rs/commit/dc588497db727a3ba943aaecc83d2a07dc6d6b0a

cc @jrmuizel

jrmuizel commented 3 years ago

I think it's better for this to stay as it is. From what I've seen, creating CTFonts from a CGFont created from a CGDataProvider creates a font descriptor that holds a reference to the CGDataProvider and is put in a font descriptor cache. While, it's not technically a leak, it gives the appearance of leaking and cause large memory usage.

We fixed something similar in Firefox: https://phabricator.services.mozilla.com/D93518

mrobinson commented 1 year ago

Closing as per the comment above.