Deserialized map's size increase in qt c++ -


I've serialized a map using QDataStream and typed the object in a file.

When I can redialize it and load the map in memory, then memory consumption is 300 MB. I have used the same QDataStream to deserialize

Can you tell me the reason that how to carry 300MB in deserialization memory to write the 1.5 MB serial object to the file on the disk?

Serialization:

  QMap & LT; QString, QSet & lt; Caststring & gt; & Gt; MyMap [100]; QSet & LT; QString & gt; MySet; // Suppose it has some data in QSet & LT; QString & gt; MySet1; // Suppose it contains some data in MyMap.insert ("a", mySet); MyMap.insert ("b", mySet1); QFile f (strOutFile); F.open (QIODevice :: WriteOnly); QDataStream StreamOut (& amp; F); Streamhot & lt; & Lt; MyMap;   

Deserialization:

  QFile f (StrInFile); QMap & LT; QString, QSet & lt; Caststring & gt; & Gt; InMap [100]; QDataStream Stream In (F, QIODevice :: ReadOnly); Stream in & gt; & Gt; InMap [index];   

I have checked the memory consumption using the MemoryTatUsx Window Library. After deserializing, memory consumed by 300 MB.

Thanks for the help.

There is something wrong with the code MyMap is it? I did not announce it. In addition, you are sorting an indicator for only myMap (this means a stack array identifier: an indicator) and I do not understand that you have 1,5 MB How to get the file.

However, even if you overload the operator to accept the template on the myMap & Lt; or simply overloaded operator & lt; & Lt; Type (three times the square tree in the beginning) you are still writing an object of 100. Of course the file can easily be smaller than the set of 100 empty objects.

I will update my answer if I see more explanation than you.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -