Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potential memory leak using Q.QPromise #9

Open
nenadlazovic opened this issue Oct 20, 2020 · 0 comments
Open

potential memory leak using Q.QPromise #9

nenadlazovic opened this issue Oct 20, 2020 · 0 comments

Comments

@nenadlazovic
Copy link

nenadlazovic commented Oct 20, 2020

Hi I am experiencing memory leak in QML app using quickpromise.
I created simple app to demonstrate.
App have timer that does some async operation. async operation is handled using quickpromise.
Code below (with timer 1 sec), leaks approx 1.6MB/min, and eventually crashes (QT 5.11 @ MSWindows or Ubuntu 18)

Any suggestions ?

import QtQuick 2.5
import QtQuick.Window 2.2

import "promise.js" as Q

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World");
    property int syncStoriesTimeoutInSec: 1;

    Component.onCompleted: {
       syncStories();
    }

    Timer {
        id: syncStoriesTimer
        interval: syncStoriesTimeoutInSec * 1000;
        running: false; repeat: false
        onTriggered: {
            syncStories();
        }
    }

    function syncStories() {
        let p = Q.promise(function (resolve, reject) {
            //for test purposes, resolve right away
            resolve({});
        });

        p.then(
            function(data) {
                console.log("resolved");
                syncStoriesTimer.start();
            },
            function(data) {
                console.log("rejected");
            }
        )
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant