R
Railway13mo ago
Seven

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?
No description
13 Replies
Percy
Percy13mo ago
Project ID: N/A
Brody
Brody13mo ago
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
Seven
Seven13mo ago
e38e07cb-3c5a-4632-83e5-1c72b381332e Any ideas on how to do that?
Brody
Brody13mo ago
I'm sure there are tons of great resources online to help you debug node memory leaks
Seven
Seven13mo ago
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
Brody
Brody13mo ago
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
Seven
Seven13mo ago
If garbage isn't be collected then why is the ram not filled? I have up to 2GB of RAM available
Brody
Brody13mo ago
you have up to 8gb available actually, you are on the hobby plan
Seven
Seven13mo ago
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
Brody
Brody13mo ago
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
Seven
Seven13mo ago
Ok thank you
Brody
Brody13mo ago
read some articles, watch some YouTube videos, use railways cron scheduler instead, I'm sure you'll come to the conclusion soon enough
Seven
Seven13mo ago
I hope so
Want results from more Discord servers?
Add your server