For me the adaptive stack size does not work as expected. [mateusz@arch avg]$ go version go version devel go1.20-c8000a18d6 Mon Aug 15 17:07:57 2022 +0000 linux/amd6
https://go.dev/play/p/B4qeIbnv2ci I've set the stackDebug in runtine to 1. stackdebug runtime output: https://pastebin.com/sLLfw62E It doesn't seem to use the avg stack size (it still allocates the default 2KB, and resizes when necessary) niedziela, 14 sierpnia 2022 o 17:44:39 UTC+2 k...@google.com napisał(a): > The initial allocation size is exported, you can use the runtime/metrics > package to look at it. Something like this: > > package main > > import ( > "fmt" > "runtime/metrics" > ) > > func main() { > s := []metrics.Sample{{Name: "/gc/stack/starting-size:bytes"}} > metrics.Read(s) > fmt.Printf("%d\n", s[0].Value.Uint64()) > } > > On Saturday, August 13, 2022 at 7:00:58 AM UTC-7 lia...@garena.com wrote: > >> Hi masters, >> >> As far as I know, go 1.19 supports self-adaptive stack size when spawning >> a goroutine, which intends to decrease the calling times of morestack that >> aims to claim more frames from heap. >> >> After each GC happens, Go runtime will calculate the average stack usage >> and the next time, goroutine would created with such a stack size. >> >> My question is, how do we validate the whole process or check it if works >> well or not. >> Is there any metric or stack size checking function, or should I use >> pprof to peek the alloc part ? >> >> Kindly thanks for all >> >> ``` >> func main() { >> go func() { >> // spawn a goroutine started from a fixed stack size >> }() >> >> runtime.GC() >> >> go func() { >> // spawn a goroutine started from an avg stack size. >> }() >> } >> ``` >> >> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/99009ccc-4614-43b4-a1a3-94002e40bdacn%40googlegroups.com.