Crystal app memory usage seems incorrect (and keeps growing)
A few days ago I deployed a Crystal app, it's a web api that uses less than 10MB of memory (running it locally it uses less than 1MB of memory) but Railway reports 40MB usage, and it keeps growing at about a 10MB/day rate every day without use (according to logs). I am not running other processes in the background, it's just an executable that serves an API and connects to a cockroachDB database elsewhere. I'd like to better understand why Railway is reporting 40MB (and the growth) as I think it's unlikely to be caused by the executable I'm running.
3 Replies
Garbage Collection in a container is different than on a local machine. Crystal uses https://www.hboehm.info/gc/ so you need to sometimes call
GC_FREE()
if you really want to min/max your RAM usage.what about the initial memory? the app boots up with 40MB right away but the memory used by the executable is much lower than that (less than 10MB)
would you be able to inspect my project?
Sadly we cannot
In the double digit MB range it could be anything. From libraries you use to random caching to anything else