JS garbage collection in QWebFrame or QWebView.



  • Is it possible to trigger garbage collection in QWebFrame or QWebView somehow? I believe to do that I need to access QScriptEngine object instantiated in QWebFrame, and call its collectGarbage() method. But I cannot find any way to do that. Is it possible?

    Respectfully,
    Michael



  • +1, is it possible?



  • Eventually,

    I've achieved this by patching Qt sources:
    @
    src/3rdparty/webkit/Source/WebKit/qt/Api/qwebframe.h
    src/3rdparty/webkit/Source/WebKit/qt/Api/qwebframe.cpp
    @

    I added two static methods to QWebFrame

    @
    void QWebFrame::collectGarbageNow() {
    gcController().garbageCollectNow();
    }

    void QWebFrame::collectGarbageSoon() {
    gcController().garbageCollectSoon();
    }
    @

    and looks like it works...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.