Bug 26716 - [Gtk] Each XMLHttpRequest leaks memory.
Summary: [Gtk] Each XMLHttpRequest leaks memory.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Major
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2009-06-25 01:51 PDT by John Kjellberg
Modified: 2009-07-20 03:05 PDT (History)
3 users (show)

See Also:


Attachments
Test case making XMLHttpRequest every 100ms (232 bytes, text/html)
2009-06-25 01:53 PDT, John Kjellberg
no flags Details
fixleak.patch (2.32 KB, patch)
2009-07-20 02:38 PDT, Xan Lopez
zecke: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Kjellberg 2009-06-25 01:51:43 PDT
I have tried this with WebKit-r43841(and earlier versions also in the past) and GtkLauncher.
I have loaded the attached file which makes a XMLHttpRequest request every 100ms. After a half an hour some MB of memory is missing. This continues until the system is really low on memory and slows down and the the oom-killer kills the app. I have checked memory usage in: /proc/<pid>/smaps and it shows increase in "[heap]" memory.

This bug is really critical since it makes it impossible to create stable kiosk-applications and such.

(This bug is sort of Bug#: 17534, however, I felt that that bug report was really misleading)
Comment 1 John Kjellberg 2009-06-25 01:53:13 PDT
Created attachment 31840 [details]
Test case making XMLHttpRequest every 100ms
Comment 2 John Kjellberg 2009-07-07 06:42:58 PDT
I have now done more testing with the nightly build r41128. That is the last version supporting both "curl" and "soup" as HTTP backend. When using "soup" as backend it leaks memory, when using "curl" it doesn't. That the leak is related to "soup" is also confirmed by valgrid testing.

I don't know if the leak is in how WebKit uses "soup" of if the leak is in soup itself. I use version 2.26.1 of libsoup.
Comment 3 Jan Alonzo 2009-07-07 06:47:45 PDT
Marking this a Gtk bug for now since it's confirmed that it's in the soup backend.
Comment 4 John Kjellberg 2009-07-07 10:49:58 PDT
I think I how found the problem in:
  WebCore/platform/network/soup/ResourceHandleSoup.cpp
line 581

  if ((equalIgnoringCase(protocol, "http") || equalIgnoringCase(protocol, "https")) && SOUP_URI_VALID_FOR_HTTP(soup_uri_new(urlString.utf8().data())))

the call to "soup_uri_new()" should be followed by a "soup_uri_free()".


I will take a deeper look at it tomorrow and perhaps create a "proposed patch" if no one beats me too it.
Comment 5 Xan Lopez 2009-07-20 02:38:59 PDT
Created attachment 33075 [details]
fixleak.patch

I think you are totally right; patch attached.
Comment 6 Xan Lopez 2009-07-20 03:05:29 PDT
Patch landed as r46117.