[Interest] Textures memory not being released

Roger zanoni rogerzanoni at gmail.com
Mon Aug 21 12:23:58 CEST 2017

Hello, I created a thread on Qt forums[1] asking for help and was told to
seek help on the mailing lists.

I work on an application that consists in a series of small minigames and
has a QQuickView that loads a main.qml file with a Loader element. We use
this Loader to swich between the minigames and they have lots of images.
The problem is that the memory used to render the image elements isn't
being released. I made a small sample qml aplication that keeps switching
the current component in a loader to simulate our application behaviour:

import QtQuick 2.7

Item {
    id: root

    width: 1920
    height: 1080

    Component {
        id: image1Component

        Image {
            source: "00-piscina.png"
            anchors.fill: parent

    Component {
        id: image2Component

        Image {
            source: "01-canyon.png"
            anchors.fill: parent

    Loader {
        id: loader
        sourceComponent: image1Component
        anchors.fill: parent

    Timer {
        repeat: true
        interval: 100
        running: true
        onTriggered: {
            loader.sourceComponent = loader.sourceComponent ==
image1Component ? image2Component : image1Component;

When I run this code, it keeps allocating memory until my laptop freezes. I
did some basic testing using valgrind and massif, and the result shows (I
posted some images on the forum thread, I'm not sure if I'm allowed to post
images to this list), if I'm not misinterpreting it, that the
scenegraph/texture classes are the ones using the memory. Is this a known

[1]: https://forum.qt.io/topic/82502/qt-qml-image-memory-consumption
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170821/6d689c94/attachment.html>

More information about the Interest mailing list