Browse Source

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.
pull/3377/head
Ayke van Laethem 2 years ago
committed by Ayke
parent
commit
17176a2cea
  1. 3
      src/runtime/gc_blocks.go

3
src/runtime/gc_blocks.go

@ -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

Loading…
Cancel
Save