⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181411 in webkit


Ignore:
Timestamp:
Mar 11, 2015, 3:32:19 PM (11 years ago)
Author:
ggaren@apple.com
Message:

Many users of Heap::reportExtraMemory* are wrong, causing lots of memory growth
https://bugs.webkit.org/show_bug.cgi?id=142593

Reviewed by Andreas Kling.

Adopt deprecatedReportExtraMemory as a short-term fix for runaway
memory growth in these cases where we have not adopted
reportExtraMemoryVisited.

Long-term, we should use reportExtraMemoryAllocated+reportExtraMemoryVisited.
That's tracked by https://bugs.webkit.org/show_bug.cgi?id=142595.

Source/JavaScriptCore:

  • API/JSBase.cpp:

(JSReportExtraMemoryCost):

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayValueMap::add):

Source/WebCore:

Using IOSDebug, I can see that the canvas stress test @ http://jsfiddle.net/fvyw4ba0/,
which used to keep > 1000 1MB NonVolatile GPU allocations live, now keeps about 10 live.

  • Modules/mediasource/SourceBuffer.cpp:

(WebCore::SourceBuffer::reportExtraMemoryAllocated):

  • bindings/js/JSDocumentCustom.cpp:

(WebCore::toJS):

  • bindings/js/JSImageDataCustom.cpp:

(WebCore::toJS):

  • bindings/js/JSNodeListCustom.cpp:

(WebCore::createWrapper):

  • dom/CollectionIndexCache.cpp:

(WebCore::reportExtraMemoryAllocatedForCollectionIndexCache):

  • html/HTMLCanvasElement.cpp:

(WebCore::HTMLCanvasElement::createImageBuffer):

  • html/HTMLImageLoader.cpp:

(WebCore::HTMLImageLoader::imageChanged):

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::parseAttribute):

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::dropProtection):

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSBase.cpp

    r181407 r181411  
    141141    JSLockHolder locker(exec);
    142142
    143     // FIXME: switch to deprecatedReportExtraMemory.
    144     // https://bugs.webkit.org/show_bug.cgi?id=142593
    145     exec->vm().heap.reportExtraMemoryAllocated(size);
     143    exec->vm().heap.deprecatedReportExtraMemory(size);
    146144}
    147145
  • trunk/Source/JavaScriptCore/ChangeLog

    r181407 r181411  
     12015-03-11  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Many users of Heap::reportExtraMemory* are wrong, causing lots of memory growth
     4        https://bugs.webkit.org/show_bug.cgi?id=142593
     5
     6        Reviewed by Andreas Kling.
     7
     8        Adopt deprecatedReportExtraMemory as a short-term fix for runaway
     9        memory growth in these cases where we have not adopted
     10        reportExtraMemoryVisited.
     11
     12        Long-term, we should use reportExtraMemoryAllocated+reportExtraMemoryVisited.
     13        That's tracked by https://bugs.webkit.org/show_bug.cgi?id=142595.
     14
     15        * API/JSBase.cpp:
     16        (JSReportExtraMemoryCost):
     17        * runtime/SparseArrayValueMap.cpp:
     18        (JSC::SparseArrayValueMap::add):
     19
    1202015-03-11  Geoffrey Garen  <ggaren@apple.com>
    221
  • trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp

    r181407 r181411  
    8181    size_t capacity = m_map.capacity();
    8282    if (capacity != m_reportedCapacity) {
    83         // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    84         // https://bugs.webkit.org/show_bug.cgi?id=142593
    85         Heap::heap(array)->reportExtraMemoryAllocated((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>)));
     83        // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     84        // https://bugs.webkit.org/show_bug.cgi?id=142595
     85        Heap::heap(array)->deprecatedReportExtraMemory((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>)));
    8686        m_reportedCapacity = capacity;
    8787    }
  • trunk/Source/WebCore/ChangeLog

    r181409 r181411  
     12015-03-11  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Many users of Heap::reportExtraMemory* are wrong, causing lots of memory growth
     4        https://bugs.webkit.org/show_bug.cgi?id=142593
     5
     6        Reviewed by Andreas Kling.
     7
     8        Adopt deprecatedReportExtraMemory as a short-term fix for runaway
     9        memory growth in these cases where we have not adopted
     10        reportExtraMemoryVisited.
     11
     12        Long-term, we should use reportExtraMemoryAllocated+reportExtraMemoryVisited.
     13        That's tracked by https://bugs.webkit.org/show_bug.cgi?id=142595.
     14
     15        Using IOSDebug, I can see that the canvas stress test @ http://jsfiddle.net/fvyw4ba0/,
     16        which used to keep > 1000 1MB NonVolatile GPU allocations live, now keeps about 10 live.
     17
     18        * Modules/mediasource/SourceBuffer.cpp:
     19        (WebCore::SourceBuffer::reportExtraMemoryAllocated):
     20        * bindings/js/JSDocumentCustom.cpp:
     21        (WebCore::toJS):
     22        * bindings/js/JSImageDataCustom.cpp:
     23        (WebCore::toJS):
     24        * bindings/js/JSNodeListCustom.cpp:
     25        (WebCore::createWrapper):
     26        * dom/CollectionIndexCache.cpp:
     27        (WebCore::reportExtraMemoryAllocatedForCollectionIndexCache):
     28        * html/HTMLCanvasElement.cpp:
     29        (WebCore::HTMLCanvasElement::createImageBuffer):
     30        * html/HTMLImageLoader.cpp:
     31        (WebCore::HTMLImageLoader::imageChanged):
     32        * html/HTMLMediaElement.cpp:
     33        (WebCore::HTMLMediaElement::parseAttribute):
     34        * xml/XMLHttpRequest.cpp:
     35        (WebCore::XMLHttpRequest::dropProtection):
     36
    1372015-03-10  Andy Estes  <aestes@apple.com>
    238
  • trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp

    r181407 r181411  
    20002000    JSC::JSLockHolder lock(scriptExecutionContext()->vm());
    20012001    if (extraMemoryCostDelta > 0) {
    2002         // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    2003         // https://bugs.webkit.org/show_bug.cgi?id=142593
    2004         scriptExecutionContext()->vm().heap.reportExtraMemoryAllocated(extraMemoryCostDelta);
     2002        // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     2003        // https://bugs.webkit.org/show_bug.cgi?id=142595
     2004        scriptExecutionContext()->vm().heap.deprecatedReportExtraMemory(extraMemoryCostDelta);
    20052005    }
    20062006}
  • trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp

    r181407 r181411  
    110110            nodeCount++;
    111111       
    112         // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    113         // https://bugs.webkit.org/show_bug.cgi?id=142593
    114         exec->heap()->reportExtraMemoryAllocated(nodeCount * sizeof(Node));
     112        // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     113        // https://bugs.webkit.org/show_bug.cgi?id=142595
     114        exec->heap()->deprecatedReportExtraMemory(nodeCount * sizeof(Node));
    115115    }
    116116
  • trunk/Source/WebCore/bindings/js/JSImageDataCustom.cpp

    r181407 r181411  
    4848    Identifier dataName(exec, "data");
    4949    wrapper->putDirect(exec->vm(), dataName, toJS(exec, globalObject, imageData->data()), DontDelete | ReadOnly);
    50     // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    51     // https://bugs.webkit.org/show_bug.cgi?id=142593
    52     exec->heap()->reportExtraMemoryAllocated(imageData->data()->length());
     50    // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     51    // https://bugs.webkit.org/show_bug.cgi?id=142595
     52    exec->heap()->deprecatedReportExtraMemory(imageData->data()->length());
    5353   
    5454    return wrapper;
  • trunk/Source/WebCore/bindings/js/JSNodeListCustom.cpp

    r181407 r181411  
    6363JSC::JSValue createWrapper(JSDOMGlobalObject& globalObject, NodeList& nodeList)
    6464{
    65     // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    66     // https://bugs.webkit.org/show_bug.cgi?id=142593
    67     globalObject.vm().heap.reportExtraMemoryAllocated(nodeList.memoryCost());
     65    // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     66    // https://bugs.webkit.org/show_bug.cgi?id=142595
     67    globalObject.vm().heap.deprecatedReportExtraMemory(nodeList.memoryCost());
    6868    return createNewWrapper<JSNodeList>(&globalObject, &nodeList);
    6969}
  • trunk/Source/WebCore/dom/CollectionIndexCache.cpp

    r181407 r181411  
    3535    JSC::VM& vm = JSDOMWindowBase::commonVM();
    3636    JSC::JSLockHolder lock(vm);
    37     // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    38     // https://bugs.webkit.org/show_bug.cgi?id=142593
    39     vm.heap.reportExtraMemoryAllocated(cost);
     37    // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     38    // https://bugs.webkit.org/show_bug.cgi?id=142595
     39    vm.heap.deprecatedReportExtraMemory(cost);
    4040}
    4141
  • trunk/Source/WebCore/html/HTMLCanvasElement.cpp

    r181407 r181411  
    577577    JSC::JSLockHolder lock(scriptExecutionContext()->vm());
    578578    size_t numBytes = 4 * m_imageBuffer->internalSize().width() * m_imageBuffer->internalSize().height();
    579     // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    580     // https://bugs.webkit.org/show_bug.cgi?id=142593
    581     scriptExecutionContext()->vm().heap.reportExtraMemoryAllocated(numBytes);
     579    // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     580    // https://bugs.webkit.org/show_bug.cgi?id=142595
     581    scriptExecutionContext()->vm().heap.deprecatedReportExtraMemory(numBytes);
    582582
    583583#if USE(IOSURFACE_CANVAS_BACKING_STORE) || ENABLE(ACCELERATED_2D_CANVAS)
  • trunk/Source/WebCore/html/HTMLImageLoader.cpp

    r181407 r181411  
    8989            JSC::VM& vm = JSDOMWindowBase::commonVM();
    9090            JSC::JSLockHolder lock(vm);
    91             // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    92             // https://bugs.webkit.org/show_bug.cgi?id=142593
    93             vm.heap.reportExtraMemoryAllocated(cachedImage->encodedSize());
     91            // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     92            // https://bugs.webkit.org/show_bug.cgi?id=142595
     93            vm.heap.deprecatedReportExtraMemory(cachedImage->encodedSize());
    9494        }
    9595    }
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r181407 r181411  
    638638
    639639            if (extraMemoryCostDelta > 0) {
    640                 // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    641                 // https://bugs.webkit.org/show_bug.cgi?id=142593
    642                 vm.heap.reportExtraMemoryAllocated(extraMemoryCostDelta);
     640                // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     641                // https://bugs.webkit.org/show_bug.cgi?id=142595
     642                vm.heap.deprecatedReportExtraMemory(extraMemoryCostDelta);
    643643            }
    644644        }
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r181407 r181411  
    914914    JSC::VM& vm = scriptExecutionContext()->vm();
    915915    JSC::JSLockHolder lock(vm);
    916     // FIXME: Switch to deprecatedReportExtraMemory, or adopt reportExtraMemoryVisited.
    917     // https://bugs.webkit.org/show_bug.cgi?id=142593
    918     vm.heap.reportExtraMemoryAllocated(m_responseBuilder.length() * 2);
     916    // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     917    // https://bugs.webkit.org/show_bug.cgi?id=142595
     918    vm.heap.deprecatedReportExtraMemory(m_responseBuilder.length() * 2);
    919919
    920920    unsetPendingActivity(this);
Note: See TracChangeset for help on using the changeset viewer.