FS#69754 - pacman -F takes much more memory than pkgfile

Attached to Project: Pacman
Opened by CUI Hao (cuihao) - Wednesday, 24 February 2021, 05:42 GMT
Task Type Bug Report
Category Backend/Core
Status Unconfirmed
Assigned To No-one
Architecture x86_64
Severity Medium
Priority Normal
Reported Version 5.2.2
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Summary and Info:
pacman -F / -Fl takes much more memory than pkgfile when working on big repo databases (like [community] and [archlinuxcn]).
On low memory machine, it may trigger OOM kill.

Steps to Reproduce:

$ sudo systemd-run -q --scope -p MemoryMax=256M pacman -Fl sl
zsh: killed sudo systemd-run --scope -p MemoryMax=256M pacman -Fl sl
$ sudo systemd-run -q --scope -p MemoryMax=2M pkgfile -l sl
community/sl /usr/
... (normal output)

pacman 256M vs pkgfile 2M... Please take a look at this.
This task depends upon

Comment by Morten Linderud (Foxboron) - Wednesday, 24 February 2021, 09:09 GMT
pkgfile parses the local pacman database and provides it's own database. Pacman loads the repositories into memory before reading. The tools are not really comparable in functionality?

If the goal is to optimize the way pacman reads databases that is probably more relevant.
Comment by Allan McRae (Allan) - Wednesday, 24 February 2021, 10:15 GMT
There has been talk about adding an iterator interface to reading the db rather than the current loading it all into memory. Essentially that would specifically used for things like searching files databases.