[webkit-gtk] webkit-gtk - memory leak?

Sergio Villar Senin svillar at igalia.com
Tue Nov 2 01:23:44 PDT 2010


En 02/11/10 08:33, Toni Koski escribiu:
> No effect with g_free(). Still leaking.
> Yes, I have tested with uzbl also.  With "www.hs.fi" I can see that the
> used memory increases when the page is reloaded again and again :-(

Maybe the problem is related to the new HTTP cache we added recently.
Even if you do not use it, you'll be using the new stream based loading
code needed by cache. I can help with that, just ping me (sergio) on IRC.

BR


> /toni
> 
> 
> On 11/01/2010 04:06 PM, Calvin M wrote:
>> you could call g_free() ?  try taking a look at some other webkit
>> examples. i'm also pretty sure that uzbl has covered FIFO piping so
>> maybe look at their code for example.
>>
>> On 1 November 2010 05:20, Toni Koski <toni.koski at firsttechnology.fi
>> <mailto:toni.koski at firsttechnology.fi>> wrote:
>>
>>     Hi list,
>>
>>     My goal is to create webkit/gtk based browser, which can be
>>     controlled via Linux pipe (fifo).
>>
>>     I have made several test with webkit, but there is always "huge"
>>     memory leaks.
>>     I have used lastest webkit build: "WebKit r70732 was built on 28
>>     October 2010".
>>     I assume that the leak is in the cache(maybe I am wrong).  Amount
>>     of the memory leak is related to loaded page.
>>     So, everything to disabling cache has done. I have also set:
>>     "m_disabled = true " in the :"WebCore/loader/Cache.cpp"
>>
>>     I have tested both cache modes with out any effects for the memory
>>     leak:
>>     - WEBKIT_CACHE_MODEL_WEB_BROWSER
>>     - WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER
>>
>>     And same result with all methods:
>>     - webkit_web_view_reload_bypass_cache
>>     - webkit_web_view_load_uri
>>     - webkit_web_view_reload
>>
>>
>>
>>
>>
>>     Even if I run callback function once with
>>     "gtk_widget_destroy(wk);", it does not release used memory.
>>
>>
>>     Plese help me, I am desperate ;-)
>>
>>
>>
>>
>>
>>     Here is my testcode:
>>
>>     #include <gtk/gtk.h>
>>     #include <webkit/webkit.h>
>>     #include <stdlib.h>
>>     #include <time.h>
>>
>>
>>
>>     static WebKitWebView* web_view;
>>
>>     static char *urls[] = {"http://www.utu.fi",
>>                        "http://www.ts.fi",
>>                        "http://www.hs.fi",
>>                        "http://www.google.fi",
>>                        "http://www.hs.fi",
>>                        "http://www.turku.fi"};
>>
>>     gboolean callback (gpointer wk)
>>     {
>>          g_print("loading\n");
>>          //webkit_web_view_load_uri(wk, urls[rand() % 6]);
>>          //webkit_web_view_load_uri(wk, "http://www.hs.fi");
>>          webkit_web_view_reload_bypass_cache(wk);
>>          return TRUE;
>>     }
>>
>>
>>     int main( int argc, char *argv[])
>>     {
>>        GtkWidget *window;
>>        GtkWidget *vbox;
>>
>>        gtk_init(&argc, &argv);
>>
>>        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>>        gtk_window_set_default_size(GTK_WINDOW(window), 1024, 768);
>>
>>
>>
>>        web_view = WEBKIT_WEB_VIEW(webkit_web_view_new ());
>>        gtk_widget_set_size_request(GTK_WIDGET(web_view), 1024,768);
>>
>>        //webkit_set_cache_model(WEBKIT_CACHE_MODEL_WEB_BROWSER);
>>        webkit_set_cache_model(WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
>>
>>        WebKitWebSettings *settings = webkit_web_settings_new();
>>        g_object_set(G_OBJECT(settings),
>>     "enable-offline-web-application-cache", FALSE, NULL);
>>        g_object_set(G_OBJECT(settings), "enable-private-browsing",
>>     TRUE, NULL);
>>        g_object_set(G_OBJECT(settings), "enable-scripts", FALSE, NULL);
>>        g_object_set(G_OBJECT(settings), "enable-plugins", FALSE, NULL);
>>        webkit_web_view_set_settings(web_view, settings);
>>
>>        WebKitWebBackForwardList *back_forward_list =
>>     webkit_web_view_get_back_forward_list(web_view);
>>        webkit_web_back_forward_list_set_limit(back_forward_list, 1);
>>
>>        gtk_container_add(GTK_CONTAINER (window), GTK_WIDGET(web_view));
>>        webkit_web_view_load_uri(web_view, "http://www.hs.fi");
>>
>>        gtk_widget_show_all(window);
>>
>>        g_timeout_add(12000, callback, web_view);
>>        gtk_main();
>>
>>        return 0;
>>     }
>>
>>
>>
>>
>>
>>
>>     /toni
>>
>>
>>     _______________________________________________
>>     webkit-gtk mailing list
>>     webkit-gtk at lists.webkit.org <mailto:webkit-gtk at lists.webkit.org>
>>     http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk
>>
>>
> 
> 
> 
> _______________________________________________
> webkit-gtk mailing list
> webkit-gtk at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-gtk



More information about the webkit-gtk mailing list