@Vogtinator
Copy link
Contributor

Vogtinator commented Feb 20, 2021

I noticed that krunner uses over 150MiB of private RAM when idle, which I tracked down to be caused by the AppStream module.
Using heaptrack, I can see that most of that is allocated by AppStream::Pool::load and its callees.

I tracked that down further by running G_MESSAGES_DEBUG=all appstreamcli search xterm, which printed System cache is stale, ignoring it.. Running appstreamcli refresh-cache manually fixed that.

That's already done by the package manager on repo metadata downloads though, but looking at the generated files I noticed that those are locale specific! The locale the package manager runs as is in most cases not the user's locale. A local root shell uses POSIX, packagekitd uses C as locale, etc.. Even if it matched, the user could change it at any point to one different from the system locale and end up with a mysteriously slower system with double (!) the usual RAM use (krunner, plasmashell)

It's much more likely that applications running as the user interact with AppStream metainfo, so IMO it makes sense to keep the cache somewhere in ~, even if only as fallback if the system cache is not usable.