diff --git a/Source/WebCore/page/win/ResourceUsageThreadWin.cpp b/Source/WebCore/page/win/ResourceUsageThreadWin.cpp index f7741af07dbfb..b624600cf38b9 100644 --- a/Source/WebCore/page/win/ResourceUsageThreadWin.cpp +++ b/Source/WebCore/page/win/ResourceUsageThreadWin.cpp @@ -118,7 +118,7 @@ void ResourceUsageThread::platformCollectCPUData(JSC::VM*, ResourceUsageData& da 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 @@ void ResourceUsageThread::platformCollectMemoryData(JSC::VM* vm, ResourceUsageDa 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::infinity()));