Re: [go-nuts] Some questions about the memory allocation strategy of channel

2021-03-27 Thread Paul Zhang
I guess I have misunderstood something about the process of the allocation and gc :) Maybe I need to learn from the gc theory first. BTW thanks for your reply. 在2021年3月20日星期六 UTC+8 上午1:20:12 写道: > On Thu, Mar 18, 2021 at 8:36 PM Paul Zhang wrote: > > > > Can I just understa

[go-nuts] Why does the closed status of channel need a uint32?

2021-03-27 Thread Paul Zhang
For the channel structure: type hchan struct { qcount uint dataqsiz uint buf unsafe.Pointer elemsize uint16 closed uint32 elemtype *_type sendxuint recvxuint recvqwaitq sendqwaitq lock mutex } Why does the closed need a uint32?

Re: [go-nuts] Some questions about the memory allocation strategy of channel

2021-03-18 Thread Paul Zhang
r the gc, and gc would find the descriptor later with more time, thus lead to worse performance? Thanks a lot! Ian Lance Taylor 于2021年3月19日周五 上午2:50写道: > On Thu, Mar 18, 2021 at 9:55 AM Paul Zhang wrote: > > > > I was reading the source code of makechan(), and these questions &g

[go-nuts] Some questions about the memory allocation strategy of channel

2021-03-18 Thread Paul Zhang
I was reading the source code of makechan(), and these questions confused me. I would appreciate it if someone could help me. Q1. What does Elements do not contain pointers. mean? Does that means that the type of channel is not a pointer type (like chan int and chan *int)? Q2. Why does the allo