Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSql query.next keep memory fat

QSql query.next keep memory fat

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 218 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on last edited by
    #1

    Hi;

    I want to take sqlite db to Eigen::Matrix from json. So I am doing:

    query.prepare("SELECT * FROM CSIJson ");
    

    while(query.next()) . {

    do stuff//

    Until this loop is finished memeory is getting bigger... it looks query keeping in the memory

    }
    When here its released..

    How can I only keep current row from sqlite and not keep all ? Its makes memory very big until exiting loop.

    Best

    1 Reply Last reply
    0
    • R Offline
      R Offline
      RahibeMeryem
      wrote on last edited by
      #2

      Answer is:

      query.setForwardOnly( true );
      
      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Does that table contain more that one column ?
        If so are you processing them all ?
        If not, then you should make a more precise query so that you only load the data you are going to use.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved