FAQ
Hi all,

Is there a description out there about what the memory backing of a buffered channel looks like? I.e., does

    c := make(chan int, 10000)

allocate something similar to a [10000]int up front, or is there a more append-like behavior that allocates slices on demand? If the latter, can the buffer "shrink" again when not in use?

I ask this to decide between manually handling what might be a temporarily large buffer of objects (larger than ints), or let this just be handled by the channel itself.

Of course I can and should benchmark, but some background info would be nice anyway. :)

//jb

(Sent from my phone - please excuse brevity and typos.)

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJun 20, '15 at 8:08a
activeJun 20, '15 at 9:31a
posts2
users2
websitegolang.org

2 users in discussion

Michael Gehring: 1 post Jakob Borg: 1 post

People

Translate

site design / logo © 2021 Grokbase