[webkit-help] Memory leak?

Zoltan Horvath hzoltan at inf.u-szeged.hu
Thu Jul 30 02:38:23 PDT 2009


Hi,

please verify this with Qt-4.5.2, because kbalazs had several patches on this 
topic.

Zoltan

Zongheng Zhou wrote at: 2009. 07. 29. 19.45.:
> 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();
> }


More information about the webkit-help mailing list