On 10/30/22 10:47, NRK wrote:
On Thu, Oct 27, 2022 at 01:19:28PM -0700, Anskrevy wrote:
Any program using libsl, or calling FcIni (directly or indirectly), that
does not call FcFini results in a small memory leak. dwm and dmenu are
effected by this.

I do not see any call to FcInit in libsl, nor do I see any such call in
dmenu/dwm. Running dmenu master branch under leak-sanitizer doesn't show
any leaks related to fontconfig (v2.13.1) either.

How exactly did you detect this leak? And are you sure this is a problem
on libsl/dmenu/dwm side and not the library itself leaking things?

- NRK

I was mistaken. I thought that one of the Fc calls in drw.c was indirectly calling FcInit but after searching the fontconfig code base I don't think that is the case.

As for how I found the leak I was using valgrind. You can try out this small program.

Here is the Makefile
https://gist.github.com/Anskrevy/52fa06719ad204cc99eb190bf20ddd84

Here is the source code
https://gist.github.com/Anskrevy/c33a4ea0455a592d04b8a917eaf6737c

And here is my valgrind output
https://gist.github.com/Anskrevy/b981453fb7fbe3fb410ac1dd883d23ad

Adding a call to FcFini in the x_cleanup function results in zero bytes being lost.

I got similar output when using valgrind on dmenu. I believe it would be the same with dwm but have yet to test it out yet.

Reply via email to