Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QWebEnginePage run javascript in loop ,the memory usage is rising
Forum Updated to NodeBB v4.3 + New Features

QWebEnginePage run javascript in loop ,the memory usage is rising

Scheduled Pinned Locked Moved QtWebEngine
3 Posts 2 Posters 1.3k 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.
  • J Offline
    J Offline
    Johnson
    wrote on last edited by
    #1

    i want to get data from webpage on the internet, i use the following code to get the webpage data,

      webView->page()->runJavaScript(read1,[=](const QVariant &V)
            {
    
              
    
                foreach (QVariant good, V.toList()) {
    
                    QMap<QString, QVariant> goodObj= good.toMap();
                    goodIndex++;
                    currentGood.setItem_url(goodObj["item_url"].toString());
                    currentGood.setId(goodObj["id"].toString());
                    currentGood.setTitle(goodObj["title"].toString());
                    currentGood.setSprice(goodObj["sprice"].toFloat());
                    currentGood.setTcount(goodObj["tcount"].toInt());
                    currentGood.setCharge(goodObj["charge"].toFloat());
                    QString tc=goodObj["tcharge"].toString();
                    tc=tc.remove(QChar(','));
                    currentGood.setTcharge(tc.toFloat());
                    currentGood.setCover(goodObj["cover"].toString());
                    currentGood.setCharge2(goodObj["charge2"].toString());
                    currentGood.setFrom_type(goodObj["from_type"].toInt());
                    currentGood.setIs_wap("1");
                    currentGood.setAct_time_end("-1");
                    currentGood.setAct_time_start("-1");
                    currentGood.PushGood();
    
                    sysSetting->setGoodIndex(goodIndex);
                    sysSetting->saveSetting();
                    emit GetNewGood(currentGood.getId());
                    QThread::msleep(30);
                    qDebug()<<goodIndex<<currentGood.getId();
                }
    
                if(pageIndex<=pageCount)
                {
                    pageIndex++;
                    sysSetting->setPageIndex(pageIndex);
                    sysSetting->saveSetting();
                }
                getGoods();
    
    
            });
    

    and i can get the data , because there is a lot of pages to get the data ,so i run this function in a loop,as time goes by ,the memory usage of the QtWebEngineProcess.exe use a lot of memory , how can i solve this problem?

    1 Reply Last reply
    0
    • I Offline
      I Offline
      Iamim
      wrote on last edited by
      #2

      I also have the memory issue. If the loaded website has many ajax request, the memory of the qwebengineprocess.exe keeps rise up which will up to 99% memory of the OS or cause the OS to be crashed. I'm using win7 x64. I checked qt 5.9.2 and qt 5.10. They all have the same issue.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Iamim
        wrote on last edited by
        #3

        the crashed issue may be reproduced when the qtwebengineprocess.exe runs the website more than 10 minutes. The long time it runs, and the high memory it takes. It seems the memory is not recycled which cause this issue.

        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