QWebView setUrl memory leak

  • The virtual memory usage of my simple qtwebkit application increases forever.
    My qtwebkit app simply loops webView->setUrl(QUrl(QStringLiteral("about:blank")), as follows,

        QWebView* webView = new QWebView(centralWidget);
    	webView->setGeometry(QRect(0, 0, width, height));
        while (true)
            msleep(1); // sleep 1 millisecond

    I think the memory usage should be stable in this case, however, the result is not.
    What's the matter? some kind of clearing is required to use setUrl() multiple times?

    • Qt version : 5.4.1
    • OS : Ubuntu 14.04 LTS

  • I think this is by design ... (if it is not a bug)
    ...If you read the description of this classs (found via that link), you find that they INTENTIONALLY designed the QWebView / QGraphicsWebView to grow in memory indefinitely until the OS reclaims the resources!

  • @ThatDud3 However, my test code only loads "about:blank", I think, which has no resource to cache. I am not still understanding why this code incurs infinite virtual memory leak...

Log in to reply