Does AlmaLinux 9 dnf module system retain memory across concurrent package transactions?
0 reputation · 08 Nov 2020, 03:40 UTC
0 reputation · 08 Nov 2020, 03:40 UTC
AlmaLinux 9's dnf module system, distributed with dnf 5.x, manages memory through cgroup accounting and leverages the kernel's page cache for package operation buffers. A central question involves whether concurrent package transactions across multiple module streams generate sustained in-memory state that appears as a leak in short-term monitoring, or whether retention is primarily a function of page cache pressure that resolves under system-wide reclaim. AlmaLinux 8 and 9 differ in dnf internals, which complicates direct comparison of memory behavior across release lines, particularly when module activation and dependency resolution overlap. Observed RSS trends can vary depending on transaction volume and system cache state, but isolating dnf-process allocation from kernel cache effects remains dependent on workload context.
Under what conditions does dnf 5.x voluntarily release in-memory buffers after a concurrent transaction completes? How does cgroup memory throttling interact with simultaneous module activation to influence process RSS trends? Which package set configurations maximize persistent memory retention without triggering automatic kernel reclaim?
35275 reputation · 08 Nov 2020, 06:07 UTC
No. DNF 5.x on AlmaLinux 9 does not retain in-memory state across separate package transactions. Each dnf invocation is its own process; when the transaction ends and the process exits, the kernel reclaims that process’s anonymous heap memory. Concurrent module activations do not create a shared memory pool that survives after the last dnf process terminates.
Confirmed: DNF 5.x loads repository metadata and solves dependencies in memory for the duration of a single run. High-volume module streams enlarge that in-memory metadata cache, which can raise RSS while the process is alive. After exit, that allocation disappears from the process view.
Likely explanation, not a confirmed leak: what appears as sustained retention is typically the Linux kernel page cache holding recently read repository and RPM data. Page cache is reported in the buff/cache column, not as a leak in a specific dnf PID, and it is released under system-wide memory pressure rather than immediately after a transaction completes.
If multiple dnf transactions run under a cgroup with MemoryLimit=, the kernel can reclaim page cache and, under sustained pressure, swap anonymous memory. This can suppress RSS growth but does not change the per-process lifecycle: each dnf process still owns its own heap. Heavy concurrency may prolong occupancy indirectly through RPM database lock contention, keeping a dnf process alive longer and therefore keeping its memory resident longer.
ps -o pid,rss,cmd -C dnffree -m before and after, watching buff/cache versus used.grep -E '^(Rss|Pss|Private_Dirty):' /proc/$PID/smapssystemd-run --scope -p MemoryLimit=512M dnf module list and observe whether the command completes or is killed.This answer assumes the default AlmaLinux 9 DNF 5.x stack. DNF 4 behavior on AlmaLinux 8 is not a reliable proxy for AlmaLinux 9. No specific package set is known to maximize persistent retention by design; DNF has no cross-transaction memory retention setting. Large module metadata sets increase per-run footprint only.
Are you measuring RSS while dnf processes are still running, or after every dnf process has exited? That distinction determines whether the observation is process heap retention or page-cache behavior, and it changes the next step.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.