Skip to content

Commit 3b290cd

Browse files
author
Mike Kaufman
committed
[MERGE #5318 @mike-kaufman] fixing bug where page de-alloc stats weren't being initialized
Merge pull request #5318 from mike-kaufman:build/mkaufman/fix-uninitialized-struct-for-page-de-allocation-stats
2 parents d864a8d + 4ab57b3 commit 3b290cd

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lib/Common/Memory/AllocatorTelemetryStats.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ struct AllocatorDecommitStats
1414
int64 numDecommitCalls;
1515
int64 numPagesDecommitted;
1616
int64 numFreePageCount;
17+
18+
AllocatorDecommitStats() :
19+
lastLeaveDecommitRegion(),
20+
maxDeltaBetweenDecommitRegionLeaveAndDecommit(0),
21+
numDecommitCalls(0),
22+
numPagesDecommitted(0),
23+
numFreePageCount(0)
24+
{}
25+
1726
};
1827

1928
struct AllocatorSizes

lib/Common/Memory/PageAllocator.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,10 +1948,13 @@ PageAllocatorBase<TVirtualAlloc, TSegment, TPageSegment>::DecommitNow(bool all)
19481948
if (this->decommitStats != nullptr)
19491949
{
19501950
this->decommitStats->numDecommitCalls++;
1951-
Js::TickDelta delta = Js::Tick::Now() - this->decommitStats->lastLeaveDecommitRegion;
1952-
if (delta > this->decommitStats->maxDeltaBetweenDecommitRegionLeaveAndDecommit)
1951+
if (this->decommitStats->lastLeaveDecommitRegion.ToMicroseconds() > 0)
19531952
{
1954-
this->decommitStats->maxDeltaBetweenDecommitRegionLeaveAndDecommit = delta;
1953+
Js::TickDelta delta = Js::Tick::Now() - this->decommitStats->lastLeaveDecommitRegion;
1954+
if (delta > this->decommitStats->maxDeltaBetweenDecommitRegionLeaveAndDecommit)
1955+
{
1956+
this->decommitStats->maxDeltaBetweenDecommitRegionLeaveAndDecommit = delta;
1957+
}
19551958
}
19561959
}
19571960
#endif

0 commit comments

Comments
 (0)