QSql query.next keep memory fat
Solved
General and Desktop
-
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
-
Answer is:
query.setForwardOnly( true );
-
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.