#1149512 qt6-l10n-tools: lconvert needs 32KiB of address space for every line of a .po file

Package:
qt6-l10n-tools
Source:
qt6-l10n-tools
Description:
Qt 6 translation tools
Submitter:
Bastian Germann
Date:
2026-09-30 13:51:03 UTC
Severity:
normal
Tags:
#1149512#5
Date:
2026-09-30 07:11:17 UTC
From:
To:
stellarium builds die because of too low address space to process a 5MiB
.po file (po/CMakeLists.txt runs lconvert -i X.po -o X.qm. Qt's loadPO()
slurps the whole file): lines.append(dev.readLine().trimmed());

In Qt 6.11, QIODevice::readLineInto() (qtbase/src/corelib/io/qiodevice.cpp) does:

"""
line->resize(qsizetype(qMin(maxSize, 1 + readBytes + d->buffer.chunkSize())));
...
line->resize(readBytes);
"""

The buffer is never released.

chunkSize() is 32767, so every line allocates exactly 32768 bytes, and the final
shrink resize() keeps that capacity (Qt's QByteArray::resize() documents
"never shrinks capacity; use squeeze()").

trimmed() then returns *this (nothing left to trim) — a shared copy — so the
32 KiB block is retained in "lines" forever.

The ~5MiB file will use over 4GiB of memory to process. Qt5 is okay because that
built the same stellarium version on 32 bit systems successfully before.

I am not sure where to report it upstream, so I bring it up here.

#1149512#12
Date:
2026-09-30 13:49:30 UTC
From:
To:
The readLineInto was introduced and switched to in qtbase.git's commit
69e6ae1670faaa901e5ad06a79fa330761f1af36 which arrived with 6.9.

Qt 5.15's readLine(), which is called for loadPO instead, calls
result.squeeze(), so Qt5 does not expose this issue.