Increase in memory when using QMetaObject::invokeMethod with qvarientlist
Unsolved
General and Desktop
-
Hi,
I Have an application with table(which is in qml) which is updated every second from cpp file using QMetaObject::invokeMethod(). Each second a new qvarientlist is created and sent to qml file by using QMetaObject::invokeMethod(). I see an increase in memory. It is increasing continously and never decreasing. Could anyone give me a hint what i am missing.Thanks & Regards
Tirupathi -
@Tirupathi-Korla Well, without seeing the code it is impossible to say why this happens...
How do you create the list? Is the list destroyed at some point? -
This is the function in cpp.
void myClass:: callBack(QByteArray ary){ QVariantList reports; reports.append("test:"); temp_report * t = ((temp_report*)(ary.data())); QString str = t->value; str.append(" $"); reports.append(str); QMetaObject::invokeMethod(qmlRootObject, "callMoneyFunction", Q_ARG(QVariant, reports)); reports.clear(); ary.clear(); }
Below is qml code
function callMoneyFunction(value){ var str = sourceModel.get(0).value; sourceModel.remove(0) sourceModel.insert(0,{"key": "Amount: " + value[0],"value":str }); }
SourceModel is listmodel of tableview.