Title: [204987] trunk/Source/WebCore
- Revision
- 204987
- Author
- akl...@apple.com
- Date
- 2016-08-25 14:57:13 -0700 (Thu, 25 Aug 2016)
Log Message
REGRESSION: RELEASE_ASSERT in ResourceUsageThread::platformThreadBody when ASan is enabled
<https://webkit.org/b/161203>
<rdar://problem/28011251>
Reviewed by Joseph Pecoraro.
* page/cocoa/ResourceUsageThreadCocoa.mm:
(WebCore::ResourceUsageThread::platformThreadBody): Remove overly optimistic assertions about
"GC owned" memory never being higher than total malloc memory usage. This accounting is not
really exact and pretending otherwise will just lead to crashes.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::externalMemoryCost): Hook up HTMLCanvasElement to the ImageBuffer
helper for reporting external memory cost. This makes accounting slightly more correct.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (204986 => 204987)
--- trunk/Source/WebCore/ChangeLog 2016-08-25 21:48:33 UTC (rev 204986)
+++ trunk/Source/WebCore/ChangeLog 2016-08-25 21:57:13 UTC (rev 204987)
@@ -1,3 +1,20 @@
+2016-08-25 Andreas Kling <akl...@apple.com>
+
+ REGRESSION: RELEASE_ASSERT in ResourceUsageThread::platformThreadBody when ASan is enabled
+ <https://webkit.org/b/161203>
+ <rdar://problem/28011251>
+
+ Reviewed by Joseph Pecoraro.
+
+ * page/cocoa/ResourceUsageThreadCocoa.mm:
+ (WebCore::ResourceUsageThread::platformThreadBody): Remove overly optimistic assertions about
+ "GC owned" memory never being higher than total malloc memory usage. This accounting is not
+ really exact and pretending otherwise will just lead to crashes.
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::externalMemoryCost): Hook up HTMLCanvasElement to the ImageBuffer
+ helper for reporting external memory cost. This makes accounting slightly more correct.
+
2016-08-25 Chris Dumez <cdu...@apple.com>
Regression(r203623): Breaks App Store application
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (204986 => 204987)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2016-08-25 21:48:33 UTC (rev 204986)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2016-08-25 21:57:13 UTC (rev 204987)
@@ -582,7 +582,7 @@
{
if (!m_imageBuffer)
return 0;
- return 4 * m_imageBuffer->internalSize().width() * m_imageBuffer->internalSize().height();
+ return m_imageBuffer->externalMemoryCost();
}
void HTMLCanvasElement::setUsesDisplayListDrawing(bool usesDisplayListDrawing)
Modified: trunk/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm (204986 => 204987)
--- trunk/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm 2016-08-25 21:48:33 UTC (rev 204986)
+++ trunk/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm 2016-08-25 21:57:13 UTC (rev 204987)
@@ -227,15 +227,16 @@
data.categories[MemoryCategory::GCOwned].dirtySize = currentGCOwnedExtra - currentGCOwnedExternal;
data.categories[MemoryCategory::GCOwned].externalSize = currentGCOwnedExternal;
- // Subtract known subchunks from the appropriate malloc bucket.
+ auto& mallocBucket = isFastMallocEnabled() ? data.categories[MemoryCategory::bmalloc] : data.categories[MemoryCategory::LibcMalloc];
+
+ // First subtract memory allocated by the GC heap, since we track that separately.
+ mallocBucket.dirtySize -= currentGCHeapCapacity;
+
+ // It would be nice to assert that the "GC owned" amount is smaller than the total dirty malloc size,
+ // but since the "GC owned" accounting is inexact, it's not currently feasible.
size_t currentGCOwnedGenerallyInMalloc = currentGCOwnedExtra - currentGCOwnedExternal;
- if (isFastMallocEnabled()) {
- RELEASE_ASSERT(currentGCOwnedGenerallyInMalloc < data.categories[MemoryCategory::bmalloc].dirtySize);
- data.categories[MemoryCategory::bmalloc].dirtySize -= currentGCHeapCapacity + currentGCOwnedGenerallyInMalloc;
- } else {
- RELEASE_ASSERT(currentGCOwnedGenerallyInMalloc < data.categories[MemoryCategory::LibcMalloc].dirtySize);
- data.categories[MemoryCategory::LibcMalloc].dirtySize -= currentGCHeapCapacity + currentGCOwnedGenerallyInMalloc;
- }
+ if (currentGCOwnedGenerallyInMalloc < mallocBucket.dirtySize)
+ mallocBucket.dirtySize -= currentGCOwnedGenerallyInMalloc;
data.totalExternalSize = currentGCOwnedExternal;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes