Why async version of simple program use to 50x more memory

Asked on stackoverflow:


The program is an echo server written using standard library, tokio and async_std. So the question is that why does the async version using tokio/async_std consume 55x more memory than synchronous one?

Memory usage:
std: 11 MB
tokio: 607 MB
async_std: 607 MB

The virtual memory that is used is not a good indicator of actual memory used. It includes things like dynamic libraries mapped into the process. You could for example have 100 processes running, all reporting a virtual memory size of 600MB and be totally fine with 2GB of RAM.
The resident set size is I guess a better (even though still not accurate) measure, which shows 1.0MB and 1.6MB respectively.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.