This is an automated archive made by the Lemmit Bot.
The original was posted on /r/rust by /u/EtherealPlatitude on 2025-04-23 05:57:51+00:00.
Using egui
, my app on Linux always launches to around 200MB of RAM usage, and if I wait a while—like 5 to 8 hours—it drops to 45MB. Now, I don't do anything allocation-wise in those few hours and from that point onwards, it stays around 45 to 60MB. Why does the first launch always allocate so much when it's not needed? I'm using tikv-jemallocator
.
[target.'cfg(not(target_os = "windows"))'.dependencies]
tikv-jemallocator = { version = "0.6.0", features = [
"unprefixed_malloc_on_supported_platforms",
"background_threads",
] }
And if I remove it and use the normal allocator from the system, it's even worse: from 200 to 400MB.
For reference, this does not happen on Windows at all.
I use btop
to check the memory usage. However, using profilers, I also see the same thing. This is exclusive to Linux. Is the kernel overallocating when there is free memory to use it as caching? That’s one potential reason.
linuxatemyram