runtime: don't call funcPC from a function
The escape analysis support is not yet good enough to avoid escaping the argument to funcPC. This causes unnecessary and often harmful memory allocation. E.g., (*cpuProfile).addExtra can be called from a signal handler, and it must not allocate memory. Move the calls to funcPC to use variables instead. This was done in the original migration to using funcPC, but was not done for newer code. In one case, in signal handling code, use getSigtramp. Reviewed-on: https://go-review.googlesource.com/92735 From-SVN: r257463
This commit is contained in:
parent
82e259b893
commit
f1a2d8b1b5
4 changed files with 9 additions and 7 deletions
|
@ -245,7 +245,7 @@ func setProcessCPUProfiler(hz int32) {
|
|||
// Enable the Go signal handler if not enabled.
|
||||
if atomic.Cas(&handlingSig[_SIGPROF], 0, 1) {
|
||||
atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF))
|
||||
setsig(_SIGPROF, funcPC(sighandler))
|
||||
setsig(_SIGPROF, getSigtramp())
|
||||
}
|
||||
} else {
|
||||
// If the Go signal handler should be disabled by default,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue