I put a question in “reddit.com/r/rust” (https://www.reddit.com/r/rust/comments/7r4n10/memory_usage/) which basically is about memory usage. The code is very simple and I cannot make sense of its memory usage. When I run the application and look at the System Monitor (Ubuntu), most of the time it consumes 14.5 MB which is Odd since sometimes the memory consumption is as low as 1.3 MB or 3.0MB or 6.0MB (when I stop and run it again). Is it normal? somebody in Reddit suggested that is the behavior of Jemalloc and it is normal for Jemalloc to allocate 14 MB.
This is 14MB of what memory? Resident? Virtual? You can look at the
/proc/<pid>/maps pseudo to see what types of memory segments are in play.
You can also strace the program and see what allocation requests are made.
That is memory column in System monitor. Resident memory is even higher around 17MB
[–]scalapar[S] 1 point just now
As it turns out (reddit/coder543 pointed that out), the issue is related to jemalloac. I added below code to replace jemalloc. First of all the size of the binary was 40% smaller and memory usage dropped to 0.7 MB!
static ALLOCATOR: System = System;