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.
Этот коммит содержится в:
родитель
3bf2487dc5
коммит
319d21e662
1 изменённых файлов: 6 добавлений и 0 удалений
|
@ -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 {
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче