diff options
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r-- | src/runtime/malloc.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index eb24fdb0e8..b044e29d95 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -847,6 +847,11 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer { if size == 0 { return unsafe.Pointer(&zerobase) } + + // It's possible for any malloc to trigger sweeping, which may in + // turn queue finalizers. Record this dynamic lock edge. + lockRankMayQueueFinalizer() + userSize := size if asanenabled { // Refer to ASAN runtime library, the malloc() function allocates extra memory, @@ -1245,7 +1250,7 @@ func nextSample() uintptr { } if GOOS == "plan9" { // Plan 9 doesn't support floating point in note handler. - if g := getg(); g == g.m.gsignal { + if gp := getg(); gp == gp.m.gsignal { return nextSampleNoFP() } } |