Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

qml loader male memory leak!



  • Hi.
    I am writing an application with c++ and qml....
    I used loader on qml but every time qml load a new page make memory leak!!!
    Here is my codes:
    Window {
    Loader {
    id: windowLoader
    source: "main.qml"
    focus: true
    }

        Connections {
            ignoreUnknownSignals: true
            target: windowLoader.item
            onChangeToPagemenuFromPermision: {
                windowLoader.source = ""
                windowLoader.source = "PageMenu.qml"
            }
    

    }

        Connections {
            ignoreUnknownSignals: true
            target: windowLoader.item
            onChangeTomainmenu: {
                windowLoader.source = ""
    
                windowLoader.source = "main.qml"
            }
    

    }
    }

    Rectangle {
    id: main
    visible: true
    ...
    }

    Rectangle {
    id: pagemenu
    visible: true
    ...
    }
    In the beginning, the amount of memory is equal to 37.2 mb, When I open the new page, the amount of memory will be 40 mb. And at the end, when going back to the first page, the amount of memory is 39 mb, instead of 37.2 mb

    please help me to solve this...
    Best Regards.


  • Qt Champions 2017

    Just by loading one page and coming back, we can't make out the memory leak. Try multiple times like this. If you see a increase & no decrease then we can conclude memory leak. If you can send me the complete example, we can try as well.