mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
runtime: don't mark the object right before a non-existing object
False positives (pointers that point to nowhere but happen to point into the heap) would result in the block just before that pointer to be marked. This is clearly not intended, so ignore such a pointer.
This commit is contained in:
committed by
Ron Evans
parent
3bf2487dc5
commit
319d21e662
@@ -327,6 +327,12 @@ func markRoots(start, end uintptr) {
|
||||
func markRoot(addr, root uintptr) {
|
||||
if looksLikePointer(root) {
|
||||
block := blockFromAddr(root)
|
||||
if block.state() == blockStateFree {
|
||||
// The to-be-marked object doesn't actually exist.
|
||||
// This could either be a dangling pointer (oops!) but most likely
|
||||
// just a false positive.
|
||||
return
|
||||
}
|
||||
head := block.findHead()
|
||||
if head.state() != blockStateMark {
|
||||
if gcDebug {
|
||||
|
||||
Reference in New Issue
Block a user