The consequences of not closing the channels in the browser?

I use Om for the client side, and throughout the life of the application, many components are mounted / unmounted. During installation, various channels open (in call blocks). And I plan to use IWillUnmount to close them too. But, firstly, my questions are: what happens to open channels? Are the resources they used released? Do not close channels (when unmounting components) can degrade browser performance in longrun? Thank.

+4
source share
1 answer

Based on a quick read of the implementation, open channels should not use resources if they have the right to garbage collection. This means that both the sender and the recipient cannot keep links to them (or must also have the right to collect).

All closing a channel makes its buffer empty and closes it so that nothing is added to the buffer. If there are no messages in the buffer, the open channel will use the same resources as the closed channel.

https://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async/impl/channels.cljs#L110

+3
source

Source: https://habr.com/ru/post/1548059/


All Articles