Results 1 to 16 of 16

Thread: Bad memory usage on QWebView I think

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Bad memory usage on QWebView I think

    Hi,

    I'm new programming QT and c++.
    I use QT 4.5 rc1 on Linux Debian.

    Recently I discover the memory usage of my program is increasing after every web page visited.
    After many hours looking for memory leaks, I make one simple application with only one QWebView and load one URL. Then after every loadFinished() signal, reload the same page over and over again.

    Result: the memory usage report by "top" increasing rapidly and don't know why.

    This is mainwindow.cpp


    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3.  
    4. MainWindow::MainWindow(QWidget *parent)
    5. : QMainWindow(parent), ui(new Ui::MainWindowClass)
    6. {
    7. ui->setupUi(this);
    8. connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(load()));
    9.  
    10. QWebPage *page = ui->webView->page();
    11. QWebHistory *history = page->history();
    12. history->setMaximumItemCount(0);
    13.  
    14. QWebSettings *settings = ui->webView->settings();
    15. settings->setMaximumPagesInCache(0);
    16. settings->setObjectCacheCapacities(0, 0, 0);
    17. settings->setIconDatabasePath("");
    18.  
    19. settings->setAttribute(QWebSettings::JavascriptEnabled, true);
    20. settings->setAttribute(QWebSettings::PluginsEnabled, true);
    21. settings->setAttribute(QWebSettings::AutoLoadImages, true);
    22. settings->setAttribute(QWebSettings::JavaEnabled, false);
    23. settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
    24. settings->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
    25. settings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, false);
    26.  
    27.  
    28. ui->webView->setUrl(QUrl("http://<url>"));
    29. }
    30.  
    31. MainWindow::~MainWindow()
    32. {
    33. delete ui;
    34. }
    35.  
    36. void MainWindow::load()
    37. {
    38. ui->webView->setUrl(QUrl("http://<url>"));
    39. }
    To copy to clipboard, switch view to plain text mode 



    I think qtwebkit isn't free memory or I'm do something bad, but don't know what can be.

    Please, if you have any suggestions, help me.

    (sorry for my not very good english)

    Joel
    Last edited by wysota; 17th February 2009 at 23:52. Reason: missing [code] tags

Similar Threads

  1. Program memory usage in windows
    By gerix in forum Installation and Deployment
    Replies: 4
    Last Post: 2nd February 2009, 00:35
  2. CPU Time & Memory Usage in QThread or QProcess
    By Davidaino in forum Qt Programming
    Replies: 0
    Last Post: 11th July 2008, 19:15
  3. CPU and Memory Usage
    By philwinder in forum Qt Programming
    Replies: 16
    Last Post: 17th May 2008, 22:25
  4. Memory usage in QTable
    By mahiapkum in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2007, 21:22
  5. How to determine memory usage?
    By nopalot in forum General Programming
    Replies: 3
    Last Post: 11th February 2007, 19:50

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.