Title: [294377] trunk/Source/WebCore/page/win/ResourceUsageThreadWin.cpp
Revision
294377
Author
basuke.suz...@sony.com
Date
2022-05-17 18:42:26 -0700 (Tue, 17 May 2022)

Log Message

[WinCairo] Add memory usage of LibcMalloc category
https://bugs.webkit.org/show_bug.cgi?id=239660

Reviewed by Ross Kirsling.

WinCairo's memory timeline just displays _javascript_ memory usage. Adding
this info shows also Page
memory usage.

* page/win/ResourceUsageThreadWin.cpp:
(WebCore::ResourceUsageThread::platformCollectMemoryData):

Canonical link: https://commits.webkit.org/250668@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/page/win/ResourceUsageThreadWin.cpp (294376 => 294377)


--- trunk/Source/WebCore/page/win/ResourceUsageThreadWin.cpp	2022-05-18 01:37:03 UTC (rev 294376)
+++ trunk/Source/WebCore/page/win/ResourceUsageThreadWin.cpp	2022-05-18 01:42:26 UTC (rev 294377)
@@ -118,7 +118,7 @@
 
 void ResourceUsageThread::platformCollectMemoryData(JSC::VM* vm, ResourceUsageData& data)
 {
-    data.totalDirtySize = memoryUsage();
+    auto usage = data.totalDirtySize = memoryUsage();
 
     size_t currentGCHeapCapacity = vm->heap.blockBytesAllocated();
     size_t currentGCOwnedExtra = vm->heap.extraMemorySize();
@@ -129,6 +129,14 @@
     data.categories[MemoryCategory::GCOwned].dirtySize = currentGCOwnedExtra - currentGCOwnedExternal;
     data.categories[MemoryCategory::GCOwned].externalSize = currentGCOwnedExternal;
 
+    usage -= currentGCHeapCapacity;
+    // Following ResourceUsageThreadCocoa implementation
+    auto currentGCOwnedGenerallyInMalloc = currentGCOwnedExtra - currentGCOwnedExternal;
+    if (currentGCOwnedGenerallyInMalloc < usage)
+        usage -= currentGCOwnedGenerallyInMalloc;
+
+    data.categories[MemoryCategory::LibcMalloc].dirtySize = usage;
+
     data.totalExternalSize = currentGCOwnedExternal;
 
     data.timeOfNextEdenCollection = data.timestamp + vm->heap.edenActivityCallback()->timeUntilFire().value_or(Seconds(std::numeric_limits<double>::infinity()));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to