webkit - Python WebkitGTK memory leak(clear function) -
i have backbone 1 page application need run hours moving along different routes. have created simple script on python runs browser , on full screen.
import sys gi.repository import gtk, gdk, webkit class browserwindow(gtk.window): def __init__(self, *args, **kwargs): super(browserwindow, self).__init__(*args, **kwargs) self.connect("destroy", gtk.main_quit) self.webview = webkit.webview() self.webview.connect("load-finished", self._load_finish) self.webview.connect("navigation-requested", self._navigation_requested) settings = self.webview.get_settings() print settings.get_property("enable-page-cache") settings.set_property("enable-page-cache", false) self.webview.set_settings(settings) self.webview.load_uri("http://www.google.com/") self.add(self.webview) self.show_all() def _load_finish(self, view, frame): print "loading completed" print view def _navigation_requested(self, view, frame, request): print "mavigation change requested" self.webview.get_back_forward_list().clear() return false def main(): gtk.init(sys.argv) window = browserwindow() window.show() window.fullscreen() gtk.main() if __name__ == "__main__": main()
the problem here everytime changes routes, increases memory amount. more images increases memory more quickly. , instead of using in memory, tends use more memory not utilize it.
i tried searching clear function, didn't it. tried qtwebkit had clear function, didn't helped either.
the real question is: sure memory use actual problem? modern browsers (and webviews) can have complex caching behaviour: "tends use more memory not utilize it" overly simplified picture of situation.
that said webkitgtk let have control on caching behaviour: take @ set_cache_model()
, related functions (these part of webkitwebcontext in webkit2gtk , global functions in webkitgtk).
Comments
Post a Comment