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. When I write a Picasa application using Webkit + HTML + Javascript, the memory cost is always increasing!
Forum Updated to NodeBB v4.3 + New Features

When I write a Picasa application using Webkit + HTML + Javascript, the memory cost is always increasing!

Scheduled Pinned Locked Moved Qt WebKit
7 Posts 4 Posters 2.9k Views 1 Watching
  • 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.
  • Q Offline
    Q Offline
    qdhuxp
    wrote on last edited by
    #1

    I write a hybrid app to get the Picasa pictures using QT Webkit and HTML+Javascript. In my application, there are 2 html pages, one is Featured photos(I name it as A) to get pictures from Picasa, the other one(I name it as B) is a normal html page with no function. And I met a problem about the memory cost:

    1. When I launch the app, A is showing, the memory size is 40M;
    2. When I click an html tag to jump to B, the memory size is 38M;
    3. When back to A from B, the memory size is 42M;
    4. When back to B from A, the memory size is 40M;
    5. When back to A from B, the memory size is 44M;

    It means when the A is showing, the memory size is added 2M. It seems like a memory leak of webkit?
    I searched a lot but has no solution. Please help!
    Appreciate!!

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qdhuxp
      wrote on last edited by
      #2

      Added:
      My QT SDK version is 4.7.4, Webkit version is 2.1

      1 Reply Last reply
      0
      • K Offline
        K Offline
        KA51O
        wrote on last edited by
        #3

        I think this is related to JavaScript. See these links for more information about the issue.

        "link1":http://old.nabble.com/Leak-reports-during-shutdown-td25668090.html
        "link2":https://bugreports.qt-project.org/browse/QTBUG-6426

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qdhuxp
          wrote on last edited by
          #4

          So, is it still a bug? It means we can not develop hybird applications using QT Webview + HTML + Javascript?!

          1 Reply Last reply
          0
          • M Offline
            M Offline
            miroslav
            wrote on last edited by
            #5

            These bug reports are form 2009 and 2010. It would be surprising if they where still there. Are we even using the same Javascript interpreter still? :-)

            Of course to debug memory leaks, it is possible to run the application in Valgrind and see what happens. My initial response to @qdhuxp was that I assume the observed behavior is due to caching of HTML and Javascript code objects.

            Mirko Boehm | mirko@kde.org | KDE e.V.
            FSFE Fellow
            Qt Certified Specialist

            1 Reply Last reply
            0
            • K Offline
              K Offline
              KA51O
              wrote on last edited by
              #6

              @miroslav I know the bug reports are quite old, but since the answer to these reports always was that the memory leaks are related to javascripts garbage collection behaviour, I assumed that this behaviour was not considered to be a bug and is most likely still present in the current Webkit version.

              1 Reply Last reply
              0
              • E Offline
                E Offline
                eikeR
                wrote on last edited by
                #7

                As far as I understand your page A (or some native stuff that gets executed when page A is shown) claims memory which is not freed when you exit page A (i.e. navigation to page B).

                Because it's a hybrid application your memory leaks can occure

                • in the web part, i.e. in your HTML pages and your JavaScript
                • in the native part.

                Try to get rid of the native part and load your html pages in a standalone browser, like chrome, firefox, safari etc. if you see the problems there too, then it's a leak in the JavaScript part. Of course I do not know if you can get rid of your native part and display the pages alone...? If you see it leaking it can be either an JS engine problem or (and unfortunately that's the common case) it's a problem in your JavaScript coding, because you have cross references or whatsoever.

                Of course it can be also a memory heap problem in your native part. Take a look if you allocate memory with new or new[] if you show page A and be sure that you did not forget the delete or delete[] if you navigate back from your page. What about your QObject instance with which you have to populate your page A by calling @addToJavaScriptWindowObject("YOUR_BRIDGE_NAME", qObjectInstance)@

                For sure this is always done as soon as you show page A.

                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