Skip to content

Commit

Permalink
[WinCairo] Add memory usage of LibcMalloc category
Browse files Browse the repository at this point in the history
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/250674@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
basuke committed May 18, 2022
1 parent bd1d43e commit ba61c75
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/WebCore/page/win/ResourceUsageThreadWin.cpp
Expand Up @@ -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();
Expand All @@ -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<double>::infinity()));
Expand Down

0 comments on commit ba61c75

Please sign in to comment.