# Why do take! and put! for channels allocate memory?

**URL:** <https://discourse.julialang.org/t/why-do-take-and-put-for-channels-allocate-memory/76513>\
**Category:** Performance\
**Tags:** memory-allocation, channel\
**Created:** [February 15, 2022, 10:02pm UTC](https://discourse.julialang.org/t/why-do-take-and-put-for-channels-allocate-memory/76513 "2022-02-15T22:02:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![taotree](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/taotree/32/31982_2.png) [@taotree](https://discourse.julialang.org/u/taotree)\
**Post date:** [February 18, 2022, 6:00pm UTC](https://discourse.julialang.org/t/why-do-take-and-put-for-channels-allocate-memory/76513/2 "2022-02-18T18:00:20Z")

</div>

I’m starting to get the feeling that the recommendation to look at the code is a good one. It appears that Channel uses a Vector for the buffer [https://github.com/JuliaLang/julia/blob/master/base/channels.jl#L39](https://github.com/JuliaLang/julia/blob/master/base/channels.jl#L39) . It’s not going to handle multithreading efficiently.

I stumbled across this announcement: [ConcurrentCollections.jl: "lock-free" dictionary, queue, etc. for Julia 1.7](https://discourse.julialang.org/t/concurrentcollections-jl-lock-free-dictionary-queue-etc-for-julia-1-7/72501) so I’ll take a look at those and see if they are more appropriate.

---

_[View the full topic](https://discourse.julialang.org/t/why-do-take-and-put-for-channels-allocate-memory/76513)._
