[Interest] Flush after QProcess::write to prevent it from filling writeBuffer
Axel Spoerl
axel.spoerl at qt.io
Sat Feb 18 19:02:25 CET 2023
Hi Philip,
Could you provide that minimal reproduction example?
Thanks
Axel
> On 18 Feb 2023, at 01:17, Philip Seeger <philip at c0xc.net> wrote:
>
> Hi there!
>
> I'm writing 1M chunks of data to a QProcess in a loop until all input data is consumed. How do I wait after calling QProcess::write() until all data has been sent to the process before calling write() again?
>
> As documented, I have tried to call waitForBytesWritten(-1) after write() but it only helps in the first iteration; then it does not seem to block until all bytes are sent to the process. The result is that my program uses almost 4G of RES memory if a 4G input file is being read and the loop finishes in a second. Closing QProcess actually sends the data to the process (takes minutes) and I don't see any progress.
>
> Internally, Qt seems to use a QByteArray as writeBuffer and I could not find where it checks if it exceeds a maximum size.
>
> I believe QProcess storing 4 GB of data in an internal buffer is wrong under any circumstances. Have I overlooked something in the documentation? How do I turn this off?
>
> I can provide a minimal example.
>
>
> Philip
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
More information about the Interest
mailing list