I want to ask that if the QFile().readAll () , returns a QByte Array then does it create a byte array on Physical memory or just provides a linked list address containing the positions of Bytes?.
can it create problem in the case of large files which are in GBs.
Yes, it does create a byte array in RAM, copying the whole memory that is in your hard drive. So you will run into issues running
QFile::readAll()
on huge files.The documentation for
QString QTextStream::readAll()
says:It is not mentioned for
QByteArray QIODevice::readAll()
(inherited byQFile
), but it will be the same, since there is no way the pointers in aQByteArray
can point somewhere in your hard disk (must be an address in the virtual memory allocated to the program by the OS, i.e. the stack or the heap).