[webkit-dev] Out-of-memory handling

Kulanthaivel kulanth at gmail.com
Thu Dec 18 23:49:48 PST 2008


Yes I do. Nokia's Memory manager has a memory collector which goes and
collects memory if the available  application memory goes below certain
threshold. It collects memory from WebCore cache. If the collected memory is
not enough then it goes ahead and stops all the browser loads and notifies
the browser application about the out of memory situation. In WebKit they
have added OOM (Out Of Memory) conditions in various places (javascript
parsing/execution, html tokenizer, text encoding, image decoding etc..) and
if there is not enough memory then it gracefully fails.

Regards
Kulanthaivel

On Fri, Dec 19, 2008 at 12:58 PM, Paul Pedriana <ppedriana at gmail.com> wrote:

>  You don't happen to know anything about the approach Nokia took, do you?
>
> Thanks
>
> Paul
>
>
> You can check the Nokia's S60WebKit MemoryManager implementation. They have
> developed a method to handle out of memory situations in WebKit
>
> On Tue, Dec 9, 2008 at 12:07 AM, Darin Adler <darin at apple.com> wrote:
>
>> On Dec 8, 2008, at 8:21 AM, Kelemen Balázs wrote:
>>
>>  A tempting approach would be using exception handling. E.g., what if we
>>> could catch a bad_alloc exception?
>>>
>>
>>  To use exception handling you'd probably have to change all the WebKit
>> code to do cleanup when an exception is propagating. Otherwise, exiting an
>> arbitrary function half way through could leave data structures in an
>> inconsistent state.
>>
>> Fixing this is a large project, almost certainly impractical.
>>
>>  Would there be any way to simply force WebKit from the browser to
>>> "shutdown" itself? When I say shutdown, I mean exiting in an elegant way,
>>> e.g., we could save history and other important information to disk (so that
>>> when the browser restarts, some info does not get lost).
>>>
>>
>>  Sure, you could do that if you make sure that the "important information"
>> is stored in data structures that have some sort of integrity guarantee,
>> which are not manipulated directly by the WebCore/WebKit code. And make sure
>> the code that writes those data structures can function without allocating
>> additional memory.
>>
>> But I don't think there's any real advantage to using exception handling
>> for this. You could have a function called when out of memory that does this
>> work.
>>
>> Another approach is to save history and other important information as you
>> go. So if you run out of memory there's nothing that needs to be done.
>>
>>    -- Darin
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>
> ------------------------------
> _______________________________________________
> webkit-dev mailing listwebkit-dev at lists.webkit.orghttp://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20081219/9e4d526a/attachment.html>


More information about the webkit-dev mailing list