[webkit-help] Memory leak?

Zongheng Zhou zongheng.zhou at gmail.com
Wed Jul 29 10:45:36 PDT 2009


Hi, all
I am using Qt 4.5.1, compiled using Sun CC 5.9 on Solaris 10. The binary
runs on Sparc machine. With the patch on
https://bugs.webkit.org/show_bug.cgi?id=24932 to make it compile.

I have written a simple testing program, which loads a web page. When the
page is loaded, it loads the page again. This continues till I press ctrl+c
to quit. It looks working fine for any URL I fed, till now I just realized
the memory leak issue...After it loads "www.cnn.com" consecutively for 800
times, the virtual memory usage reaches 1600M with resident memory 1500M
(When the program initiates, it's 130M and 100M, respectively). This leakage
also happens for many other URLs...

My program is quite simple:

class MyTest : public QObject
{
    Q_OBJECT
public:
    MyTest();
private slots:
    void onLoaded();
private:
    QWebPage _page;
    int _count;
};

MyTest::MyTest() : _count(0)
{
    QUrl url("http://www.cnn.com");
    _page.mainFrame()->load(url);
    connect(&_page, SIGNAL(loadFinished(bool)), this, SLOT(onFinished()));
}

void MyTest::onFinished()
{
    fprintf(stderr, "Done round: %d\n", _count);
    _count++;
    QUrl url("http://www.cnn.com");
    _page.mainFrame()->load(url);
}

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWebSettings *globalSetting = QWebSettings::globalSettings();
    globalSetting->setAttribute(QWebSettings::AutoLoadImages, false);
    globalSetting->setAttribute(QWebSettings::PluginsEnabled, false);
    globalSetting->setAttribute(QWebSettings::DeveloperExtrasEnabled,
false);
    globalSetting->setAttribute(QWebSettings::PrivateBrowsingEnabled,
false);

    MyTest * test = new MyTest();

    return app.exec();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20090729/131bd944/attachment.html>


More information about the webkit-help mailing list