QString: Allocating more than needed?

Stefan Heimers kde-optimize@mail.kde.org
Sun, 26 Jan 2003 11:20:05 +0100


There was a small discussion on the qt-interest Mailing list (two years 
ago) about how QString allocates more memory than needed, in order to 
avoid reallocation when growing the string.
 
http://lists.trolltech.com/qt-interest/2001-03/msg00446.html


- Does Qt still do this in the same manner?

- Is there a way to create qstrings with a fixed length, which won't 
waste memory in case you know they will never grow?

- It would be nice to have an option to set the maximum expected length 
of a qstring, so it won't allocate in excess, or too little if you know 
a string will grow considerably.


Stefan