Skip to content

Commit

Permalink
runtime: reset nextAlloc to the start of the heap after a GC
Browse files Browse the repository at this point in the history
  • Loading branch information
dgryski committed Aug 8, 2024
1 parent 5a8ffb5 commit 926b918
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/gc_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer {
if nextAlloc > maxBlock {
maxBlock = nextAlloc - 1
}
if heapScanCount == 2 {
// if we had to do a GC to find this allocation, reset nextAlloc to the start of the heap
nextAlloc = 0
}
return pointer
}
}
Expand Down

0 comments on commit 926b918

Please sign in to comment.