Valgrind reports memory leak in g_irepository_require()
It seems that the keys going in to the typelibs
and lazy_typelibs
hash tables of the default repository are leaked, because the default repository is never freed. This will happen whenever you call g_irepository_require()
with NULL
to operate on the default repository.
I think Valgrind must have gotten more sophisticated recently, as it started detecting a number of similar leaks in GJS that it didn't detect before. I fixed these by using static variables with destructors, but that solution is only available in C++. I think the best option might be to ship a gobject-introspection Valgrind suppression file.
All in all probably a small and inconsequential leak, but annoying when running analysis tools.
==12301== 64 bytes in 1 blocks are definitely lost in loss record 1,273 of 1,623
==12301== at 0x483AD19: realloc (vg_replace_malloc.c:836)
==12301== by 0x586D086: g_realloc (gmem.c:164)
==12301== by 0x5889116: g_string_maybe_expand (gstring.c:102)
==12301== by 0x5889449: g_string_insert_len (gstring.c:478)
==12301== by 0x5889449: g_string_insert_len (gstring.c:426)
==12301== by 0x55BFDBF: build_typelib_key (girepository.c:263)
==12301== by 0x55C1561: register_internal (girepository.c:437)
==12301== by 0x55C10F1: require_internal (girepository.c:1616)
==12301== by 0x55C1508: load_dependencies_recurse (girepository.c:383)
==12301== by 0x55C1508: register_internal (girepository.c:428)
==12301== by 0x55C10F1: require_internal (girepository.c:1616)
==12301== by 0x48DA3D2: ??? (repo.cpp:114)