Why does runtime.panicstring cause a gc cycle ?

246 views
Skip to first unread message

Dave Cheney

unread,
Feb 17, 2014, 12:28:59 AM2/17/14
to golang-dev
Hello

Related to issue 7347 I have a question about the stacktrace in the final goroutine. Is this just bad luck, or can something be done to avoid allocating space for the panic string?

Cheers

Dave

panda(~/src) % go run panic.go

runtime: unexpected return pc for runtime.main called from 0x0

fatal error: unknown caller pc


runtime stack:

runtime.throw(0x64dd1)

/home/dfc/go/src/pkg/runtime/panic.c:464 +0x5c

runtime.gentraceback(0x1a39c, 0xb6ecaed0, 0x0, 0x102020a0, 0x0, ...)

/home/dfc/go/src/pkg/runtime/traceback_arm.c:105 +0x2f0

addstackroots(0x102020a0, 0xbecb04fc)

/home/dfc/go/src/pkg/runtime/mgc0.c:1643 +0x184

markroot(0x10226000, 0x5)

/home/dfc/go/src/pkg/runtime/mgc0.c:1340 +0xf8

runtime.parfordo(0x10226000)

/home/dfc/go/src/pkg/runtime/parfor.c:105 +0xc0

gc(0xb6ecaeec)

/home/dfc/go/src/pkg/runtime/mgc0.c:2317 +0x1cc

mgc(0x102020a0)

/home/dfc/go/src/pkg/runtime/mgc0.c:2263 +0x30

runtime.mcall(0x67694)

/home/dfc/go/src/pkg/runtime/asm_arm.s:163 +0x3c


goroutine 16 [garbage collection]:

runtime.gc(0x0)

/home/dfc/go/src/pkg/runtime/mgc0.c:2232 +0x1b8 fp=0xb6ecaef4

runtime.mallocgc(0x20, 0x0, 0x0)

/home/dfc/go/src/pkg/runtime/malloc.goc:213 +0x18c fp=0xb6ecaf34

runtime.mal(0x14)

/home/dfc/go/src/pkg/runtime/malloc.goc:833 +0x38 fp=0xb6ecaf44

runtime.panic(0x34578, 0x65120)

/home/dfc/go/src/pkg/runtime/panic.c:217 +0x2c fp=0xb6ecaf64

runtime.panicstring(0x65120)

/home/dfc/go/src/pkg/runtime/panic.c:482 +0xac fp=0xb6ecaf78

runtime.sigpanic()

/home/dfc/go/src/pkg/runtime/os_linux.c:234 +0x110 fp=0xb6ecaf84

main.func·001()

/home/dfc/src/panic.go:4 +0x8 fp=0xb6ecaf88

runtime.main()

/home/dfc/go/src/pkg/runtime/proc.c:231 +0xf8 fp=0xb6ecafbc

runtime: unexpected return pc for runtime.main called from 0x0

runtime.main()

/home/dfc/go/src/pkg/runtime/proc.c:231 +0xf8 fp=0xb6ecaff0

created by _rt0_go

/home/dfc/go/src/pkg/runtime/asm_arm.s:72 +0xb0


goroutine 17 [runnable]:

runtime.MHeap_Scavenger()

/home/dfc/go/src/pkg/runtime/mheap.c:530

runtime.goexit()

/home/dfc/go/src/pkg/runtime/proc.c:1438

exit status 2

Russ Cox

unread,
Feb 17, 2014, 9:34:27 PM2/17/14
to Dave Cheney, golang-dev
It seems like runtime.panic could declare a Panic p on the stack instead of calling runtime.mal. Want to try it?

Dave Cheney

unread,
Feb 21, 2014, 12:59:25 AM2/21/14
to Russ Cox, golang-dev
This appears to be workable, https://codereview.appspot.com/66830043

I'm still testing this CL on arm, but I would appreciate your thoughts.

Cheers

Dave
Reply all
Reply to author
Forward
0 new messages