Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Memory Management in Qml
Forum Updated to NodeBB v4.3 + New Features

Memory Management in Qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 614 Views 2 Watching
  • 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.
  • S Offline
    S Offline
    Saman19
    wrote on last edited by
    #1

    Hello.
    I developed a program by Qt and Qml!
    My application has several window that works with stackview.
    every time clicked on button, stackview push new window and if clicked on back, pop window!

    in this case I confront memory leak...
    MainWindow memory is 23.7 MB
    page1: 32MB
    page3: 33.7

    agian back to main window
    MainWindow : 28MB
    page1: 33.8MB
    Page2: 33.8MB

    agian back to main window
    Page4:39.2MB
    MainWindow: 39.2MB

    each window that opens, the memory increases!
    How can solved this?

    My stackview Code :

    toolBar: BorderImage {
        border.bottom: 8
        source: "qrc:/Icons/toolbar.png"
        width: parent.width
        height: 70
        Rectangle {
            id: backButton
            width: opacity ? 60 : 0
            anchors.left: parent.left
            anchors.leftMargin: 20
            opacity: stackView.depth > 1 ? 1 : 0
            anchors.verticalCenter: parent.verticalCenter
            antialiasing: true
            height: 60
            radius: 4
            color: backmouse.pressed ? "#222" : "transparent"
            Behavior on opacity { NumberAnimation{} }
            Image {
                anchors.verticalCenter: parent.verticalCenter
                source: "qrc:/Icons/navigation_previous_item.png"
                Text {
                    font.pixelSize: 42
                    Behavior on x { NumberAnimation{ easing.type: Easing.OutCubic} }
                    x: backButton.x + backButton.width + 20
                    anchors.verticalCenter: parent.verticalCenter
                    text: "back"
                    color: "white"
                    font.family: webFont.name
                }
            }
            MouseArea {
                id: backmouse
                anchors.fill: parent
                anchors.margins: -10
                onClicked:
                {
                    stackView.pop()
                    gc()
                }
    
            }
        }
        Text {
            font.pixelSize: 42
            Behavior on x { NumberAnimation{ easing.type: Easing.OutCubic} }
            anchors.verticalCenter: parent.verticalCenter
            anchors.horizontalCenter: parent.horizontalCenter
            color: "white"
            text: "Irsa Soft"
            font.family: webFont.name
    
        }
    }
    StackView {
            id: stackView
            anchors.fill: parent
            // Implements back key navigation
            focus: true
            Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) {
                                 stackView.pop();
                                 destroyed()
                                 gc()
                                 event.accepted = true;
                             }
    
            initialItem: Item {
    
                width: parent.width
                height: parent.height
                MainMenu {
                    anchors.fill: parent
                    onClicked : stackView.push({item:url,destroyOnPop:true})
                    onChangeToshowTraffic : stackView.push({item:url,destroyOnPop: true})
                    onChangeToSaveEnter: stackView.push({item:url,destroyOnPop: true})
                    onChangeTomission: stackView.push({item:url,destroyOnPop: true})
                }
            }
    
        }
    
    1 Reply Last reply
    0
    • W Offline
      W Offline
      While_e
      wrote on last edited by
      #2

      I too ran into this type of issue. I am currently pushing/popping between two windows, and am slowly increasing the memory until the app crashes. You ever find any insights or solutions to this issue?

      1 Reply Last reply
      0

      • Login

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