Skip to content

Commit 9f136f5

Browse files
committed
runtime: add race detector tips to reportZombies func
We can find a few issues finally turned out to be a race condition, such as #47513. I believe such a tip can eliminate the need for developers to file this kind of issue in the first place.
1 parent 2eac154 commit 9f136f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/mgcsweep.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ func (sl *sweepLocked) sweep(preserve bool) bool {
855855
// pointer to that object and marked it.
856856
func (s *mspan) reportZombies() {
857857
printlock()
858-
print("runtime: marked free object in span ", s, ", elemsize=", s.elemsize, " freeindex=", s.freeindex, " (bad use of unsafe.Pointer? try -d=checkptr)\n")
858+
print("runtime: marked free object in span ", s, ", elemsize=", s.elemsize, " freeindex=", s.freeindex, " (bad use of unsafe.Pointer or having race conditions? try -d=checkptr or -race)\n")
859859
mbits := s.markBitsForBase()
860860
abits := s.allocBitsForIndex(0)
861861
for i := uintptr(0); i < uintptr(s.nelems); i++ {

0 commit comments

Comments
 (0)