Changeset 180053 in webkit


Ignore:
Timestamp:
Feb 13, 2015, 9:38:50 AM (11 years ago)
Author:
akling@apple.com
Message:

[iOS] Refine GC behavior in response to process suspension and memory pressure.
<https://webkit.org/b/141543>
<rdar://problem/19738024>

Reviewed by Geoffrey Garen.

Do an immediate full garbage collection when the web process is about to
be suspended (when another tab is moving to the foreground on iOS.)
This ensures that we make a best effort to reduce the process footprint
before we lose the ability to execute code.

When receiving a memory pressure warning, tell the garbage collector to
accelerate its next collection (by calling garbageCollectSoon().)
This gives us some confidence that a collection will happen within a
reasonable timeframe, but doesn't risk dooming us to a loop of endless
garbage collections.

  • platform/cocoa/MemoryPressureHandlerCocoa.mm:

(WebCore::MemoryPressureHandler::platformReleaseMemory):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r180051 r180053  
     12015-02-13  Andreas Kling  <akling@apple.com>
     2
     3        [iOS] Refine GC behavior in response to process suspension and memory pressure.
     4        <https://webkit.org/b/141543>
     5        <rdar://problem/19738024>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Do an immediate full garbage collection when the web process is about to
     10        be suspended (when another tab is moving to the foreground on iOS.)
     11        This ensures that we make a best effort to reduce the process footprint
     12        before we lose the ability to execute code.
     13
     14        When receiving a memory pressure warning, tell the garbage collector to
     15        accelerate its next collection (by calling garbageCollectSoon().)
     16        This gives us some confidence that a collection will happen within a
     17        reasonable timeframe, but doesn't risk dooming us to a loop of endless
     18        garbage collections.
     19
     20        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
     21        (WebCore::MemoryPressureHandler::platformReleaseMemory):
     22
    1232015-02-13  Antti Koivisto  <antti@apple.com>
    224
  • trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm

    r179737 r180053  
    6262
    6363#if PLATFORM(IOS)
    64     {
     64    if (memoryPressureHandler().isUnderMemoryPressure()) {
     65        gcController().garbageCollectSoon();
     66    } else {
     67        // If we're not under memory pressure, that means we're here due to impending process suspension.
     68        // Do a full GC since this is our last chance to run any code.
    6569        ReliefLogger log("Collecting JavaScript garbage");
    6670        gcController().garbageCollectNow();
Note: See TracChangeset for help on using the changeset viewer.