https://bugs.documentfoundation.org/show_bug.cgi?id=174032

            Bug ID: 174032
           Summary: Each print job leaks ~1,800 font file mmaps (never
                    unmapped); RSS and mapping count grow without bound
           Product: LibreOffice
           Version: 26.8.1.1 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Printing and PDF export
          Assignee: [email protected]
          Reporter: [email protected]

Description:
Printing a document leaves a large number of new memory mappings of installed
font files in the soffice.bin process. They are never unmapped, even after the
document is closed. RAM use is not affected much (free/available barely change,
the pages are shared file-backed pages), but RSS and the number of mappings
grow linearly with each print.


Steps to Reproduce:
1. Start LibreOffice and open a one-page document (the same document each
time).
2. Note wc -l < /proc/$(pidof soffice.bin)/maps and the RSS.
3. Print the document to a printer, then close it.
4. Repeat.


Actual Results:
~ $ pid=$(pidof soffice.bin)
~ $ wc -l < /proc/$pid/maps
3064
~ $ # prints the same document about 10 times
~ $ wc -l < /proc/$pid/maps
21182
~ $ # prints the same document about 20 times
~ $ wc -l < /proc/$pid/maps
57392
~ $ # prints the same document about 10 times
~ $ wc -l < /proc/$pid/maps
75498

That is about 1,810 new mappings per print, and RSS grows by about 160-180 MB
per print. After ~40 prints, awk '{print $6}' /proc/PID/maps | sort | uniq -c |
sort -rn shows ~41 mappings of each font file, e.g. DejaVuSans.ttf,
LiberationSerif-Bold.ttf and the lm*.otf files.

smaps_rollup before/after one print: Shared_Clean +159 MB, Anonymous +8 MB, so
it is file-backed pages, not heap. malloc_trim(0) frees only ~3 MB.
memory.reclaim on the cgroup drops RSS back down, so the pages are reclaimable.
free shows no real increase in used memory.


Expected Results:
Font files opened during printing are unmapped when the job ends, and the
mapping count and RSS stay roughly constant across prints.




Reproducible: Always


User Profile Reset: No

Additional Info:
The growth scales with the number of fonts visible to fontconfig. Launching
with FONTCONFIG_FILE pointing to a config that exposes only the DejaVu and
Liberation font directories reduces RSS growth to ~9 MB per print (10 prints:
313 MB → 399 MB). With the full font set it is ~170 MB per print.

~ $ cat /proc/sys/vm/max_map_count
1048576
~ $ awk '{print $6}' /proc/$pid/maps | sort | uniq -c | sort -rn | head -20
    152 
     82 /home/desgua/Backup/fonts/Arimo/Arimo
     82 /home/desgua/Backup/fonts/Agave/agave
     46 /home/desgua/Backup/fonts/Comfortaa/Comfortaa-VariableFont_wght.ttf
     43 /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
     42 /usr/share/fonts/truetype/liberation/LiberationSerif-Bold.ttf
     42 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
     41 /usr/share/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmsansquot8-bold.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmsansdemicond10-oblique.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmsans9-oblique.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmsans8-oblique.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmsans17-oblique.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmsans12-oblique.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmsans10-bold.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmromanunsl10-regular.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmromanslant9-regular.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmromanslant8-regular.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmromanslant17-regular.otf
     41 /usr/share/texmf/fonts/opentype/public/lm/lmromanslant12-regular.otf
~ $ off
office           offlineimap      offload-arch-21  offload-arch-22  
~ $ office --version
LibreOffice 26.8.1.1 680(Build:1)

~ $ grep PRETTY_NAME /etc/os-release
PRETTY_NAME="Debian GNU/Linux forky/sid"
~ $ fc-list | wc -l
2980
~ $ lpstat -p -d
printer HP-DeskJet-3700-series is idle.  enabled since Wed 07 Oct 2026 06:55:55
AM -03
printer HP-HP-LaserJet-M14-M17 is idle.  enabled since Sat 17 Oct 2026 04:26:04
PM -03
system default destination: HP-HP-LaserJet-M14-M17
~ $ 

Libreoffice > Help > About shows:
UI Render: default; VCL: gtk3

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to