PDA

View Full Version : QString memory usage



jogeshwarakundi
13th December 2007, 05:21
Hi,
small, stupid doubt:
does a QString allocated on stack also store its actual contents on heap?
i mean,

f()
{
QString str("asdf");
}
the actual asdf is stored on heap only right?
For me stack is a very precious resource and so wanted to confirm this assumption before i proceed, though I guess the Implicit Sharing etc of Qt would not be possible of data also resided on stack only!!!

ChristianEhrlicher
13th December 2007, 06:48
Nearly all Qt data types use pimpl method to store their data. Therefore all data is allocated on the heap.