Ram usage grows up to 1.5GB and decreases in the case of restart. Using bree (cron) in node.js
My code executes a script every 4 hours using cron (bree).
With the first run, the RAM grows by about 300MB, in the second run it grows by approximately 100MB
However, as you can see in the image (I reproduce the problem up to 4 times), in the third execution, a third step is formed up to 1.5GB that grows almost flat throughout the subsequent executions
When I restart the application, the usage drops to approximately 150MB (which still seems like a lot to me)
Why this sudden jump between the second and third execution if it is the same code? How can I limit RAM usage without rebooting on every run?
13 Replies
Project ID:
N/A
at first glance, this looks like a memory leak to me, doesn't really have all that much to do with railway
limiting ram would just cause instabilities, you want to fix your memory leak
e38e07cb-3c5a-4632-83e5-1c72b381332e
Any ideas on how to do that?
I'm sure there are tons of great resources online to help you debug node memory leaks
After days of searching online I can't find the reason why it doesn't look like a uniform staircase.
Since its jumps are practically exponential
Why doesn't RAM fill up? It remains uniform at 1.5GB
garbage isn't be collected
nodes GC works on mysterious ways
this isn't a problem with the platform though, so unfortunately there's not much we can do to help you here
If garbage isn't be collected then why is the ram not filled?
I have up to 2GB of RAM available
you have up to 8gb available actually, you are on the hobby plan
Then the question makes even more sense.
If garbage isn't be collected then why is the ram not filled?
I have up to "8GB" of RAM available
I'm sorry but unfortunately we can't really offer code help, these threads are mainly for platform help / platform onboarding, this is a code issue
Ok thank you
read some articles, watch some YouTube videos, use railways cron scheduler instead, I'm sure you'll come to the conclusion soon enough
I hope so