summaryrefslogtreecommitdiff
path: root/src/gc/gc.cpp
diff options
context:
space:
mode:
authorAndy Hanson <anhans@microsoft.com>2019-03-05 14:29:31 -0800
committerAndy Hanson <anhans@microsoft.com>2019-03-20 12:14:08 -0700
commitcc14e6cecf6984c991fe906c9fe4b327b4f93f96 (patch)
tree90d6bf4b8ac794555f72a53e5d8a4bda19fecddf /src/gc/gc.cpp
parented52a006c01a582d4d34add40c318d6f324b99ba (diff)
downloadcoreclr-cc14e6cecf6984c991fe906c9fe4b327b4f93f96.tar.gz
coreclr-cc14e6cecf6984c991fe906c9fe4b327b4f93f96.tar.bz2
coreclr-cc14e6cecf6984c991fe906c9fe4b327b4f93f96.zip
Don't compact LOH just because a heap_hard_limit exists
This is based on a perf test with 100% survival in a container, before and after #22180. GC pause times were greater after that commit. Debugging showed that the reason was that after, we were always doing compacting GC, and objects were staying in generation 1 and not making it to generation 2. The reason was that in the "after" build, `should_compact_loh()` was always returning true if heap_hard_limit was set; currently if we do an LOH compaction, we compact all other generations too. As the comment indicates, we should decide that automatically, not just set it to true all the time.
Diffstat (limited to 'src/gc/gc.cpp')
-rw-r--r--src/gc/gc.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index 01f51c275c..669aab2568 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -5854,7 +5854,7 @@ void gc_mechanisms::init_mechanisms()
promotion = FALSE;//TRUE;
compaction = TRUE;
#ifdef FEATURE_LOH_COMPACTION
- loh_compaction = gc_heap::should_compact_loh();
+ loh_compaction = gc_heap::loh_compaction_requested();
#else
loh_compaction = FALSE;
#endif //FEATURE_LOH_COMPACTION
@@ -21365,10 +21365,10 @@ retry:
}
}
-BOOL gc_heap::should_compact_loh()
+BOOL gc_heap::loh_compaction_requested()
{
// If hard limit is specified GC will automatically decide if LOH needs to be compacted.
- return (heap_hard_limit || loh_compaction_always_p || (loh_compaction_mode != loh_compaction_default));
+ return (loh_compaction_always_p || (loh_compaction_mode != loh_compaction_default));
}
inline
@@ -21538,7 +21538,7 @@ BOOL gc_heap::plan_loh()
void gc_heap::compact_loh()
{
- assert (should_compact_loh());
+ assert (loh_compaction_requested() || heap_hard_limit);
generation* gen = large_object_generation;
heap_segment* start_seg = heap_segment_rw (generation_start_segment (gen));