Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QWebView setUrl memory leak
QtWS25 Last Chance

QWebView setUrl memory leak

Scheduled Pinned Locked Moved Unsolved Qt WebKit
qtwebkit
3 Posts 2 Posters 2.2k Views
  • 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
    sinjohr
    wrote on last edited by sinjohr
    #1

    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->setObjectName(QStringLiteral("webView"));
    	webView->setGeometry(QRect(0, 0, width, height));
    
        while (true)
        {
            webView->setUrl(QUrl(QStringLiteral("about:blank")));
            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
    1 Reply Last reply
    0
    • T Offline
      T Offline
      ThatDud3
      wrote on last edited by
      #2

      I think this is by design ... (if it is not a bug)
      http://forum.qt.io/topic/10832/memory-size-increases-per-page-load/4
      ...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!

      S 1 Reply Last reply
      0
      • T ThatDud3

        I think this is by design ... (if it is not a bug)
        http://forum.qt.io/topic/10832/memory-size-increases-per-page-load/4
        ...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!

        S Offline
        S Offline
        sinjohr
        wrote on last edited by
        #3

        @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...

        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