[Qt-interest] How to properly destroy QWebViews?

Joel A. Iturra P. tortuguero at gmail.com
Wed Oct 28 18:01:23 CET 2009


Hi,

My way to test if one object is deleted is put a debug line on his destructor.

But you must know, IMHO qtwebkit has a leak memory don't resolve yet.
If you use QWebFrame::load(QUrl) instead setUrl you'll have better performance.

Joel


On 10/28/09, Peter <pgeorges at gmail.com> wrote:
> Lets imagine we have a QTabWidget derived object with multiple QWebViews
> derived widgets attached to it. When a tab is closed, would this not be
> enough to completely destroy the QWebView widget and free up all the memory?
>
> class TabWidget : public QTabWidget
>
> class WebPanel : public QWebView
>
>
> void TabWidget::closeTab(int index)
>
> {
>
>   QWidget* widget = QTabWidget::widget(index);
>
>   removeTab(index);
>
>   widget->deleteLater(); //or delete widget
>
> }
>
>
> or even (if it makes any difference?):
>
>
> void TabWidget::closeTab(int index)
>
> {
>
>   WebPanel* webPanel = dynamic_cast<WebPanel*>(widget(index));
>
>   removeTab(index);
>
>   webPanel->deleteLater(); //or delete webPanel
>
> }
>
>
> What else must be done to completely free the memory used? If I goto a large
> site, the memory usage shoots up but closing a tab does not clear it all.
> Does QtWebKit keep some other objects laying around? Is it because I share a
> single networkAccessManager between each QWebView?
>
>
> Any assistance would be appreciated!
>
>
> Cheers
>


-- 
Joel A. Iturra
Santiago - Chile



More information about the Qt-interest-old mailing list