Skip to content

Memory leak on each http request #26

Description

@delacko

I made a simple qml file with a timer that generates a HTTP GET request every 10 ms.
This causes memory leak at a rate of approximately 30-40 kB / second.

A smaller l

eak also exists if interval between requests is larger - ie. 200 ms request interval - leak seems proportional to number of requests.

Leak does not depend on the size of HTTP GET response. I tested with response of approximately 10 bytes, 100 kB, 10 MB.

Test environment: Linux Desktop, Qt 5.15.0

Sample:


import QtQuick 2.15
import QtQuick.Window 2.15
import com.cutehacks.duperagent 1.0 as Http

Window {
    id: window
    visible: true
    width: 640
    height: 480
    property int idx: 0
    Timer
    {
        id: requestTimer
        interval: 50
        repeat: true
        triggeredOnStart: true
        running: true
        onTriggered:
        {
            request(idx++)
            gc()
        }
    }
    Component.onCompleted:
    {
        Http.Request.config({
               cache: false
           });
    }
    function request(reqIdx){
            console.log("request initiated "+ reqIdx)

        var url = "http://localhost:9001/Screenshot_20200620_101301.png"
        Http.Request
        .get(url)
        .timeout(5000)
        .end(function(err, res) {
            console.log("request finished "+ reqIdx)
        });
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions