diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 4fda8a3c23..d376a4a26a 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -1224,7 +1224,7 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer { // All slots hold nil so no scanning is needed. // This may be racing with GC so do it atomically if there can be // a race marking the bit. - if gcphase != _GCoff { + if writeBarrier.enabled { gcmarknewobject(span, uintptr(x)) }