runtime: zero freed memory
This helps to find bugs in the GC. It does have a performance impact so it's only enabled when asserts are enabled.
Этот коммит содержится в:
родитель
fb73074325
коммит
17176a2cea
1 изменённых файлов: 3 добавлений и 0 удалений
|
@ -168,6 +168,9 @@ func (b gcBlock) markFree() {
|
||||||
if gcAsserts && b.state() != blockStateFree {
|
if gcAsserts && b.state() != blockStateFree {
|
||||||
runtimePanic("gc: markFree() was not successful")
|
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
|
// unmark changes the state of the block from mark to head. It must be marked
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче