简体   繁体   English

Clojure 中的通道会导致内存泄漏吗?

[英]Can channel cause memory leak in clojure?

Can the go block below cause a memory leak in Clojure if data is no longer put into in channel?可以go以下原因Clojure中的内存泄漏块,如果数据不再投入in渠道呢? Do i need to find a way to close the channel?我需要找到关闭频道的方法吗?

(defn printer
  [in]
  (go (while true (println (<! in)))))

Given there is no way for this go block to end, yes it will continue to use some extremely small amount of memory in the system to keep track of it.鉴于此go块无法结束,是的,它将继续使用系统中极少量的内存来跟踪它。 However as it's a go it will not consume a thread.但是因为它是一个go它不会消耗一个线程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM