https://bugs.kde.org/show_bug.cgi?id=375765

--- Comment #8 from Fabian Vogt <fab...@ritter-vogt.de> ---
Git commit d2d52da38016a4b3443c6b9f65e4d54dd8106134 by Fabian Vogt.
Committed on 22/09/2018 at 16:23.
Pushed by fvogt into branch 'master'.

Avoid QByteArray::remove in AccessManagerReply::readData

Summary:
If m_data contains a relatively large amount of data, calls to readData are
really expensive as it copies the remaining data around in memory.

For some reason, readAll() on an AccessManagerReply results in calls to
readData with a maxSize of 16384 until it returns 0. That's pretty much the
worst case scenario, but also the most likely used one.

Avoid the expensive remove operation by only calling remove if it saves
sufficient memory.

Additionally, bail out if maxSize is < 0.

Test Plan:
Ran accessmanagertest, passes.
Downloaded files with kio-gdrive, not stuck in memmove anymore.
It still dies for very large files, but that's a design issue in kio-gdrive
which can't be addressed in KIO.

Reviewers: #frameworks, elvisangelaccio, dfaure, svuorela

Reviewed By: svuorela

Subscribers: svuorela, ngraham, bruns, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15426

M  +43   -9    src/widgets/accessmanagerreply_p.cpp
M  +1    -0    src/widgets/accessmanagerreply_p.h

https://commits.kde.org/kio/d2d52da38016a4b3443c6b9f65e4d54dd8106134

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to