This helps to find bugs in the GC. It does have a performance impact so
it's only enabled when asserts are enabled.
Этот коммит содержится в:
Ayke van Laethem 2022-12-18 17:27:23 +01:00 коммит произвёл Ayke
родитель fb73074325
коммит 17176a2cea

Просмотреть файл

@ -168,6 +168,9 @@ func (b gcBlock) markFree() {
if gcAsserts && b.state() != blockStateFree {
runtimePanic("gc: markFree() was not successful")
}
if gcAsserts {
*(*[wordsPerBlock]uintptr)(unsafe.Pointer(b.address())) = [wordsPerBlock]uintptr{}
}
}
// unmark changes the state of the block from mark to head. It must be marked