Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.7.0, 5.8.0, 5.9.0, 6.x
-
None
-
win7, qt-opensource-windows-x86-mingw530-5.7.0.exe
-
-
038c1c597 (dev), a151f3461 (6.5), 6c424dbcb (dev), 21a4a2daf (6.7)
Description
C++'s string (and other C++ stl classes) has clear() and empty() all only change the string's size to 0, not change the string's capacity and not free the memory.
but qt's QString::clear() will change the capacity and free the memory as below:
inline void QString::clear(){ if (!isNull()) *this = QString(); }
this is not efficient when use the same QString many times, so QString::clear() better be the same with the C++'s string.
thanks!
Attachments
Issue Links
- relates to
-
QTBUG-31283 QByteArray::clear() should not free the reserved memory.
- Open
Gerrit Reviews
For Gerrit Dashboard: QTBUG-60745 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
441267,1 | QString/QByteArray: preserve capacity() on clear() | dev | qt/qtbase | Status: NEW | -1 | 0 |
191186,9 | QString, QByteArray: overhaul capacity handling | dev | qt/qtbase | Status: ABANDONED | -2 | 0 |
475754,2 | QString/QByteArray::op>>: don't assume clear() makes the container isNull() | dev | qt/qtbase | Status: MERGED | +2 | 0 |
475963,2 | QString/QByteArray::op>>: don't assume clear() makes the container isNull() | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
543546,3 | QCborStreamReader: don't assume that clear() results in isNull() | dev | qt/qtbase | Status: MERGED | +2 | 0 |
544291,2 | QCborStreamReader: don't assume that clear() results in isNull() | 6.7 | qt/qtbase | Status: MERGED | +2 | 0 |