summaryrefslogtreecommitdiff
path: root/src/gc
diff options
context:
space:
mode:
authorVladimir Sadov <vsadov@microsoft.com>2019-06-06 12:12:55 -0700
committerGitHub <noreply@github.com>2019-06-06 12:12:55 -0700
commit476dc1cb88a0dcedd891a0ef7a2e05d5c2f94f68 (patch)
treef570b76b9385f41d223969c3c53b5dc6ad4a5421 /src/gc
parent926230b2a14f1e6c9b02334ef5114b837c094a6e (diff)
downloadcoreclr-476dc1cb88a0dcedd891a0ef7a2e05d5c2f94f68.tar.gz
coreclr-476dc1cb88a0dcedd891a0ef7a2e05d5c2f94f68.tar.bz2
coreclr-476dc1cb88a0dcedd891a0ef7a2e05d5c2f94f68.zip
Clear syncblock early when `VERIFY_HEAP && DEBUG` to prevent verification asserts. (#24992)
Fixes:#24879
Diffstat (limited to 'src/gc')
-rw-r--r--src/gc/gc.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index 100e2c222f..35f46d4b90 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -12341,6 +12341,17 @@ found_fit:
}
#endif //FEATURE_LOH_COMPACTION
+#if defined (VERIFY_HEAP) && defined (_DEBUG)
+ // we are responsible for cleaning the syncblock and we will do it later
+ // as a part of cleanup routine and when not holding the heap lock.
+ // However, once we move "allocated" forward and if another thread initiate verification of
+ // the previous object, it may consider the syncblock in the "next" eligible for validation.
+ // (see also: object.cpp/Object::ValidateInner)
+ // Make sure it will see cleaned up state to prevent triggering occasional verification failures.
+ // And make sure the write happens before updating "allocated"
+ VolatileStore(((void**)allocated - 1), (void*)0); //clear the sync block
+#endif //VERIFY_HEAP && _DEBUG
+
dprintf (3, ("found fit at end of seg: %Ix", old_alloc));
uint8_t* old_alloc;