Picking a global allocator
I wrote a long running axum webserver in rust that has metrics, so I am able to see the process' memory usage. Over the course of a month, I noticed the server was slowly increasing in memory until it reached it's limit and OOM'd and restarted. This is a sign of a memory leak for sure, so I have gone over all my server's code multiple times, used profiling, and I cannot see where a leak could be. However, in profiling I did notice that my code does do a lot of allocating and de-allocating on the heap. I could probably optimize some of this, but aside from performance hits on this, I swear its not leaking anything. I did some more research and read the default allocator in rust is pretty simple and is best for short running, single-threaded, simple memory applications. My server, is pretty allocation intense, multi threaded (tokio), and runs 24/7.
Should I be swapping to a difference allocator for this server? I've never done much digging into allocators so I don't know too much here. In some short reading, I saw jemalloc is for multi threaded, long running applications. Could the reason the process' memory is going up over time that the standard allocator is not handling the intense allocating and deallocating, leading to memory fragmentation over time?