Results 1 to 2 of 2

Thread: QString memory consumption

  1. #1

    Default QString memory consumption

    Heya,

    i have some pretty strange problem with QString and QT Containers.
    My program is loading strings and an incremental primary key from a database table and inserts them into a hash.

    QHash<quint64, QString>

    After the insert the original data gets freed. So i suppose a deep copy happens internally. With Windows it is no problem at all and the memory consumption is very low. But when i try it under Linux it uses up to 100mb for really small strings.
    I have tried a hash with std::string and it works without any problem at all.

    I tried to reproduce it in main() , but there does not seem to be a problem at all.

    I would appreciate any hint ;-)

  2. #2

    Default Re: QString memory consumption

    I have made some more tests.

    basically i am retrieving data from a database. For each row an object gets allocated which saves all the attributes as members.

    The Class returns QString for example and that QString gets added in the above-mentioned hash.


    The following consumes way more memory:

    QString temp = pTBReleaseEntry->getFileHash();


    releaseIdToString.insert(pTBReleaseEntry->getReleaseId(), temp);



    The following consumes way less memory:


    QString temp(pTBReleaseEntry->getFileHash().toLatin1().data());

    releaseIdToString.insert(pTBReleaseEntry->getReleaseId(), temp);


    I suppose this is some QT issue, which i do not really understand. ;-)

Similar Threads

  1. QGraphicsScene - memory consumption
    By mateuszzz88 in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 29th November 2010, 20:39
  2. QTreeView memory consumption
    By eyeofhell in forum Qt Programming
    Replies: 6
    Last Post: 19th November 2010, 01:04
  3. QSqlQueryModel and memory consumption
    By lunatic fringe in forum Qt Programming
    Replies: 3
    Last Post: 5th February 2010, 11:09
  4. QTableView memory consumption
    By LordQt in forum Qt Programming
    Replies: 7
    Last Post: 9th December 2008, 16:51
  5. Pixmap memory consumption
    By bunjee in forum Qt Programming
    Replies: 9
    Last Post: 29th November 2007, 15:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.