PDA

View Full Version : Maximum size for local storage using a qt applciation



ejoshva
27th March 2015, 09:50
I am creating an application where in I will be storing some data in QSetting.
I would like to know what's the maximum storage size, if it uses system registers.

anda_skoa
27th March 2015, 10:04
If you look at the API of QFile (and its base class QIODevice), you'll see it uses qint64 as its size type.
So its limit of addressable size is 2^63 - 1 bytes.

Somewhere in the Exabyte range if I remember correctly.

Cheers,
_

yeye_olive
27th March 2015, 10:10
Qt's API for manipulating files (e.g. QFile) by itself imposes no unreasonable limits beyond those of the underlying platform. For instance, all positions in QIODevice-derived classes are represented by qint64. In theory, the API can cope with files up to 2^63 bytes long.

However, you have to be careful with how you use this API if you want your application to scale. For instance, if you use a QNetworkReply to download a file and write it to disk with QFile, make sure you read and write in blocks whose size is bounded; avoid methods like QIODevice::readAll().

ejoshva
27th March 2015, 10:49
What is the maximum size I can store in QSETTINGS

anda_skoa
27th March 2015, 11:28
For a single key? Very likely backend specific, i.e. a INI file value is probably restricted differently than a Window Registry value.

Cheers,
_

ejoshva
27th March 2015, 12:09
yes for single key

anda_skoa
27th March 2015, 13:36
Stop changing the topic and content of the thread, this is annyoing to anyone involved and extremely confusing to anyone finding the thread later on!

You can likely find the restrictions for Windows Registry somewhere on MSDN.
A couple of hundret characters are surely no problem, maybe even a couple of Kilobytes.

For INI it is very likely larger than anything you might want to put into a INI file value in the first place, RAM is usually magnitudes smaller than disk space.

Cheers,
_

d_stranz
27th March 2015, 15:43
RAM is usually magnitudes smaller than disk space

Windows Registry key and value sizes are discussed in MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724881%28v=vs.85%29.aspx).

If you use an INI file format, then you will be limited by the smaller of:

- the amount of RAM you have available for creating the thing (string, array, whatever) you want to write to QSettings
- the maximum size of files allowed in your Windows version and disk format
- size limits imposed by whatever Qt/C++ type you are using to hold the information

What are you trying to store? And if it is big enough to worry about size, why would you want to store it in the Registry anyway? This sounds like something that is more appropriate for a configuration file stored on disk, not something that uses a system resource.

Why should your users suffer the cost of having the Registry using up larger than needed system resources ALL THE TIME, whether they are using your program or not?