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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.