PDA

View Full Version : how does Qt handle memory allocation in the case of readAll



feraudyh
2nd February 2014, 21:26
Suppose I have a Qfile, I call on file.readAll()
This returns a bytearray containing the contents of the file.
Since it does not return a pointer, you cannot delete the returned value.
So how does Qt avoid memory leaks?
Is there a reference counting system?

ChrisW67
2nd February 2014, 21:33
The QByteArray contents are destroyed when the QByteArray you put them in goes out of scope. This is standard C++ behaviour and nothing specific to Qt.