QString: Allocating more than needed?
Alexander Neundorf
kde-optimize@mail.kde.org
Sun, 26 Jan 2003 13:38:53 +0100
On Sunday 26 January 2003 13:23, Stefan Heimers wrote:
> Am Sonntag, 26. Januar 2003 11.27 schrieb David Faure:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On Sunday 26 January 2003 11:20, Stefan Heimers wrote:
> > > - Is there a way to create qstrings with a fixed length, which
> > > won't waste memory in case you know they will never grow?
> >
> > Yes, setLength().
>
> I just had a look at the sources of Qt 3.1.1. It's in tools/qstring.cpp.
>
> setLength() is not what I am looking for, but what I am complaining
> about. It allocates much more than needed, just in case the string
> might grow.
>
> So memory is wasted on strings you know not to grow at all.
What's the situation with QConstString ?
I never used it until now and I think this class isn't very well known.
Bye
Alex