#30195 [Feature]: Using libjemalloc2 for efficient memory management and garbage collection
### Check for existing issues
- [x] I have searched the existing issues and checked that my issue is not a duplicate.
### The Feature
In our production environment, we add libjemalloc2 as a memory manager during image build. Memory consumption at service startup and after applying migrations decreased from 1.2 GB to 700 MB. Uncontrolled memory accumulation during long-running service operation has been completely eliminated; memory is now efficiently cleaned and freed (effective flushes occur approximately every hour according to graphs). No impact on performance—only efficient garbage collection and OOM protection.
### Motivation, pitch
Install libjemalloc2 + specify the following commands in Dockerfile: ``` ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2" ENV MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:30000,muzzy_decay_ms:30000" ```
### What part of LiteLLM is this about?
Proxy
### LiteLLM is hiring a founding backend engineer, are you interested in joining us and shipping to all our users?
No
### Twitter / LinkedIn details
_No response_