[Qt-interest] Qt memory management.

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Wed Aug 18 12:52:49 CEST 2010


Ramesh wrote on Wednesday, August 18, 2010 12:30 PM:

> ...
> So it means, assignment of one Qstring to another does copy or not?

No: the fact that QString does not inherit from QObject does /not/ imply that its internal data is copied at the time of assignment ("deep copy"). In fact the internal QString data is only copied *when needed*, that is when one of the copies is modified ("copy on write").

Actually that is all well documented here: http://doc.trolltech.com/4.6/qstring.html#details

And here: http://doc.trolltech.com/4.6/implicit-sharing.html

Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list