[webkit-help] [webkit-dev] A question related to memory usage of webkit engine

zaheer ahmad zaheer.mot at gmail.com
Sun Nov 15 23:02:31 PST 2009


Replying on webkit-help.

Hi,

The behavior you observe is the how the memory allocator works on linux. for
performance reasons, the heap memory is increased/decreased at the end
(using brk). hence even if a small chunk at the end is not released (which
is quite likely), the process cannot give back free memory that is scattered
in the heap.However the free memory will be reused for furthur allocations
(e.g. if you open cnn.com again) you should not ideally go beyond 50M. A
combination of various factors e.g. memory fragmentation, caching, lazy
release of allocated resources, would mean you would actually see this
increase quite a bit. even with this the memory usage should stabilize at a
higher value with continous browsing (much bigger than what a big page would
take AFAIK).

Also the point that the used memory is not availalbe to the system is a
problem on low memory devices (e..g if you system has 128M RAM and browser
hogs 50M even if you take it to background, it would not give back the
memory for other apps). I dont know if a solution exists for this.. Did you
check Android (the behavior should be same).

On linux, you can use malloc_stats() to get info on used/free memory.

thanks,
Zaheer

On Wed, Nov 11, 2009 at 7:46 PM, Gyuyoung Kim <gyuyoung at gmail.com> wrote:

> Hello,
>
> I have a quesition about memory usage of webkit. When I run GtkLauncher,
> the GtkLauncher goes to the www.google.com.
> The memory usage of GtkLauncher is about 22MB measured by top command.
> Then, GtkLaucher's memory usage becomes larger by about
> 50MB when GtkLauncher goes to the heavy websites, for example, nytimes.com,
> cnn.com, abc.com and so on. However, when GtkLauncher goes
> back to the google.com, the GtkLauncher's memory usage is still around
> 50MB. it seems to me GtkLauncher just returns a little memory to system.
>
> I would like to know why webkit engine doesn't return heap memory to system
> when go back to the simple website(google). In mobile environment,
> I think this situation can be a problem.
>
> I suspected that FastMalloc stores memory blocks. But, even though
> FastMalloc is disabled, memory usage of webkit engine is same situation
> as FastMalloc is enabled.
>
> Or, does webkit engine store webpages? (page cache?)
>
> Does anyone know the reason? Please let me know.
>
> Thanks,
> Gyuyoung Kim
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20091116/3a19f346/attachment.html>


More information about the webkit-help mailing list