[Qt-interest] Qt memory management.

Ramesh ramesh.bs at robosoftin.com
Wed Aug 18 13:33:09 CEST 2010


Thanks Andre..
Thanks for the clarification...

Have a nice day :)..

-----Original Message-----
From: Andre Somers [mailto:andre at familiesomers.nl]
Sent: Wednesday, August 18, 2010 4:58 PM
To: Ramesh
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Qt memory management.

  Op 18-8-2010 13:10, Ramesh schreef:
> Fine andres..
> I do agree.. but what about this case.
>
> QString a = "foo"; // "QStringPrivate" has a refcount of 1
> QString b = a;// Shallow copy of QStringPrivate, that now has a refcount
of
> 2
> a = "chock" // in this case?
>
> If we change the value of a, then what about b?
>
>   b should point to "foo" right. So what happens in this case, I guess
> Deepcopy occurs right?
Good guess :-)
A deep copy occurs on write. No matter who instantiates that write.

André


-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.



More information about the Qt-interest-old mailing list