Replies: 1 comment 3 replies
-
This sounds like memory fragmentation. Tokio doesn't do anything special when allocating memory. For example, when spawning a task, Tokio just uses |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have a scenario where multiple runtimes are being used.
Each runtime allocates some objects, which are then deallocated, so there is no memory leak in each runtime. However, each runtime seems to exclusively occupy the memory it has allocated (and deallocated), preventing other runtimes from using that memory. Similarly, other runtimes also exclusively occupy their respective allocated (and deallocated) memory. This ultimately leads to program crashes.
Here is a simple example where a linked list is used for memory allocation purposes. Additionally, we have test jemalloc with an aggressive configuration in this situation, but similar problems still persist. We would like to understand why this is happening, how the tokio runtimes manage their memory. Furthermore, is there a way to share memory between multiple runtimes?
And there is the output:
The following is a counterexample against tokio::spawn:
and the output:
It can be observed that after the initial allocation, RSS no longer changes.
Below is output of test on jemalloc on multiple tokio runtimes, It is similar to the results of Unix system allocator.
If additional information is required, please tell us. We need your help!
Beta Was this translation helpful? Give feedback.
All reactions