mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user