If I have a buffered channel like this:
ch := make(chan int, 1000000)
is 8MB of memory allocated off the bat, or does the memory allocation grow/shrink depending on the amount of data?
If I have a buffered channel like this:
ch := make(chan int, 1000000)
is 8MB of memory allocated off the bat, or does the memory allocation grow/shrink depending on the amount of data?
The full size of the buffer (plus I believe two words for the channel itself) will be allocated up front and retained until it is garbage collected.