]> Cypherpunks repositories - gostls13.git/commit
runtime: stack allocate Panic structure during runtime.panic
authorDave Cheney <dave@cheney.net>
Mon, 24 Feb 2014 16:09:19 +0000 (11:09 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 24 Feb 2014 16:09:19 +0000 (11:09 -0500)
commitdd740343e0dec4f998575a49b6a90b14db6b8749
tree2775ca0d796d3e8c5a18803469c8e1ba053ab1fa
parent86c976ffd094c0326c9ba2e3d47d9cc6d73084cf
runtime: stack allocate Panic structure during runtime.panic

Update #7347

When runtime.panic is called the *Panic is malloced from the heap. This can lead to a gc cycle while panicing which can make a bad situation worse.

It appears to be possible to stack allocate the Panic and avoid malloc'ing during a panic.

Ref: https://groups.google.com/d/topic/golang-dev/OfxqpklGkh0/discussion

LGTM=minux.ma, dvyukov, rsc
R=r, minux.ma, gobot, rsc, dvyukov
CC=golang-codereviews
https://golang.org/cl/66830043
src/pkg/runtime/panic.c