On Thu, Aug 18, 2022 at 11:30 AM Kurtis Rader <kra...@skepticism.us> wrote:
> On Wed, Aug 17, 2022 at 8:18 PM tapi...@gmail.com <tapir....@gmail.com> > wrote: > >> I'm a bit wondering about how the following case will be affected by the >> change: >> 1. Initially, there is one goroutine, which stack size is large at the >> time of a GC process. >> 2. After the GC process, a large quantity of goroutines start. They all >> need small stacks. >> But now the runtime will allocate a very large stack for each of them. >> >> Then is much memory wasted? Will the stacks of the new goroutines shrink >> at the next GC process? >> > > I can't help but wonder why, if you care so much about this type of issue, > you did not make any attempt to answer your own question? Why not assume > the Go team is competent (thus handling your scenario in a reasonable, if > not optimal, fashion) unless you have evidence to the contrary? Why didn't > you take a few minutes to write a Go program to test your own hypothesis? > Questions are great unless you make no attempt to answer your own question. > > So you don't care so much about this type of issue? I wonder why you don't care? When I investigate something, I ask questions in communities firstly, to save time. For experts who understand the problem, it will spend them no much time to make an answer. I never denied the competentness of Go team. I don't think I'm able to write a Go program to test in a few minutes. In fact, this will be my last attempt and is why I asked the question here. If you are able to, could you write one? I will be very appreciate it. > > >> On Saturday, August 13, 2022 at 10:00:58 PM UTC+8 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/e922b755-8205-462b-91ed-b9391b6fa2b2n%40googlegroups.com >> <https://groups.google.com/d/msgid/golang-nuts/e922b755-8205-462b-91ed-b9391b6fa2b2n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Kurtis Rader > Caretaker of the exceptional canines Junior and Hank > -- 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/CAHbs%3DNZFiu4ftiDbJxTpv7eLPSENhnYK5EhGHJdZvMxKiKeJtw%40mail.gmail.com.