Memory leak of AppInfo and other types when starting apps or changing the app list
src/AppInfos.cpp
seems to leak new AppInfo
when continually starting new unique apps, or reloading app info upon GAppInfoMonitor
"changed" -> loadXDGDirectories()
(which heap-allocates new AppInfo
objects for both changed and unchanged apps, and doesn't delete the old AppInfo*
, nor removes them from the three maps).
Not sure about the best strategy to fix this. Perhaps you could store shared_ptr<AppInfo>
, or pick one collection to own unique_ptr<AppInfo>
. And perhaps AppInfo* search(std::string id)
should be made to return shared_ptr
instead, if the callers hold onto it (eg. Dock::mGroups
which is currently a Store::KeyStore<AppInfo*, Group*>
, and I suspect it currently holds onto stale AppInfo
even after you reload XDG directories and stop using the stale AppInfo
).
I don't know if failing to remove outdated AppInfo*
when apps are uninstalled is related to #15 (closed). However I don't experience crashing or warnings (as mentioned in that issue) when editing my menus, and I feel suggesting asan or valgrind would be helpful to debug crashes. The tricky part is that because docklike is a .so launched in a child process of xfce4-panel, rather than a standalone app, asan may require LD_PRELOAD=/usr/lib/libasan.so xfce4-panel
and valgrind may require valgrind --trace-children=yes xfce4-panel
.
Perhaps you could instead launch valgrind /usr/lib/xfce4/panel/wrapper-2.0 /usr/lib/xfce4/panel/plugins/libdocklike.so 0 '' '' '' ''
to launch a second docklike. The console messages look normal, but I don't even know where it renders to (I don't see it on-screen).