summaryrefslogtreecommitdiff
path: root/src/gc
diff options
context:
space:
mode:
authorSung Yoon Whang <suwhang@microsoft.com>2019-08-16 16:30:34 -0700
committerGitHub <noreply@github.com>2019-08-16 16:30:34 -0700
commit3d24ceef049e486e994e8a3e7c3f2d03d3f2a3ec (patch)
tree55d04c2508e89024bdd570c486ba86775037e2c1 /src/gc
parent64d982fb77b57918433d0b51f7247c5be5037a22 (diff)
downloadcoreclr-3d24ceef049e486e994e8a3e7c3f2d03d3f2a3ec.tar.gz
coreclr-3d24ceef049e486e994e8a3e7c3f2d03d3f2a3ec.tar.bz2
coreclr-3d24ceef049e486e994e8a3e7c3f2d03d3f2a3ec.zip
Fix a potential division by 0 in post GC counter computation (#26085) (#26089)
* Fix a potential division by 0 in post GC counter computation * Remove useless code
Diffstat (limited to 'src/gc')
-rw-r--r--src/gc/gcee.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gc/gcee.cpp b/src/gc/gcee.cpp
index e8bbdfa952..c75ba9bb23 100644
--- a/src/gc/gcee.cpp
+++ b/src/gc/gcee.cpp
@@ -223,8 +223,11 @@ void GCHeap::UpdatePostGCCounters()
}
// Update percent time spent in GC
- g_percentTimeInGCSinceLastGC = (int)(g_TotalTimeInGC * 100 / _timeInGCBase);
+ if (_timeInGCBase != 0)
+ g_percentTimeInGCSinceLastGC = (int)(g_TotalTimeInGC * 100 / _timeInGCBase);
+ else
+ g_percentTimeInGCSinceLastGC = 0;
g_TotalTimeSinceLastGCEnd = _currentPerfCounterTimer;
}