Fontconfig uses pointer arithmetics to compute the distance from an object base pointer to a member structure and the result is stored in intptr_t type members. This causes reported memory leaks in fontconfig in applications compiled with GCC's AddressSanitizer and Valgrind, too. The fact that the size of intptr_t always equals to the size of a pointer makes this whole thing look like code obfuscation. It also slows down the code slightly. Pointer arithmetics and storing the result is always slower than just storing the pointer value. The amount of reported memory leaks in AddressSanitizer is so much that it makes genuine debugging hard, like searching for a needle in a haystack. Please, use real pointers instead of intptr_t.
This definitely was not done for obfuscation purposes, but to make the caches relocatable while maintaining existing public API. So, unfortunately, that cannot change until fontconfig 3. For valgrind, there's a suppression file on the web. For AddressSanitizer I don't know if something like that is possible.
(In reply to Behdad Esfahbod from comment #1) > This definitely was not done for obfuscation purposes, but to make the > caches relocatable while maintaining existing public API. So, > unfortunately, that cannot change until fontconfig 3. For valgrind, there's > a suppression file on the web. For AddressSanitizer I don't know if > something like that is possible. Where?
For example: https://gist.github.com/bert/758760 Maybe we should clean up some of that and ship it. I don't think all marked there are correct.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/77.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.