The worst thing I did in Rust was using unbounded asynchronous channels. It took days to figure out that my program had backpressure, and channels ate up all RAM.
So, since then, I have always used sync_channel or bounded channels from Crossbeam.
The worst thing I did in Rust was using unbounded asynchronous channels. It took days to figure out that my program had backpressure, and channels ate up all RAM.
So, since then, I have always used sync_channel or bounded channels from Crossbeam.
For further actions, you may consider blocking this person and/or reporting abuse
Vyacheslav Chub -
Afonso Barracha -
Gabriel Grubba -
Flavius -
Once suspended, veer66 will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, veer66 will be able to comment and publish posts again.
Once unpublished, all posts by veer66 will become hidden and only accessible to themselves.
If veer66 is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Vee Satayamas.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag veer66:
Unflagging veer66 will restore default visibility to their posts.
Top comments (3)
Your "post" fits in a Tweet: I don't think it's very useful as it is.
But it has a lot of potential. Writing a post explaining the problems and showing a solution with the relevant code could be much more useful to readers.
Could you please elaborate on unbounded asynchronous channels? They're not described in The Rust Programming Language, I could only find them mentioned in Rust by Example. And by "backpressure" you mean that the channels were steadily growing...? P.S.: I'm a Rust newbie.
You are right. I created a channel using the std::sync::mpsc::channel function. So the channel can grow until my computer is out of memory. I knew this before I wrote my code. However, after my program became more complex, there were many assumptions why the program took more than 32GB of memory after running for one week. It took me days to figure out that a producer among many of them sent much more data than a consumer can finish processing in time.
These days, I use a bounded channel from the Crossbeam library instead.
A bounded channel will block a producer if the channel reaches the limit, and it will unblock if the channel has some space. So the program won't use up the memory.