Increase in memory when using QMetaObject::invokeMethod with qvarientlist

  • 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

  • Lifetime Qt Champion

    @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;
                temp_report * t = ((temp_report*)(;
                QString str = t->value;
                str.append(" $");
                QMetaObject::invokeMethod(qmlRootObject, "callMoneyFunction",
                                          Q_ARG(QVariant, reports));

    Below is qml code

            function callMoneyFunction(value){
                var str = sourceModel.get(0).value;
                sourceModel.insert(0,{"key": "Amount: "  + value[0],"value":str });

    SourceModel is listmodel of tableview.

Log in to reply