From 2608c03824b9b94d2f006a2bc4a08d0269e16997 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Wed, 29 Oct 2025 15:46:01 -0700 Subject: [PATCH] [vm, gc] Avoid growth policy data race. TEST=tsan Bug: https://github.com/dart-lang/sdk/issues/61862 Change-Id: Icd16140999282b33fd9fbcceda901b82e4267c7a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458421 Reviewed-by: Alexander Aprelev Commit-Queue: Ryan Macnak --- runtime/vm/dart_api_impl.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc index 085b8d9f2fe..33ab56e141b 100644 --- a/runtime/vm/dart_api_impl.cc +++ b/runtime/vm/dart_api_impl.cc @@ -6008,6 +6008,9 @@ DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures) { // If this is an auxiliary isolate inside a larger isolate group, we will not // re-initialize the growth policy. if (I->group()->ContainsOnlyOneIsolate()) { + // Helper tasks like the background compile might be running. Avoid data + // races on the growth policy. + GcSafepointOperationScope safepoint(T); I->group()->heap()->old_space()->EvaluateAfterLoading(); }