#memory leak

52 messages · Page 1 of 1 (latest)

supple hazel
#

I don’t know but for some reason there’s so much memory that is allocated but can’t or doesn’t need to be used by current node heap

fair yarrowBOT
#

Project ID: N/A

queen burrowBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

supple hazel
#

And I see an increase of memory usage day by day, and when I try to take heap snapshots, it just is 58MB

#

Heap snapshot can’t find the other missing 230MB of the memory

#

there's several values here, actual memory usage is around 260MB, which is not acceptable for a simple discord bot, and the heap snapshot did only take 58MB of memory data

foggy hamlet
#

Keep in mind that memory may be allocated while not being included in the heap
your app's architecture plays a big role in the memory allocated vs memory used

Railway's metrics are accurate and won't lie about your app's resource usage
I'd recommend learning about what kinds of things could cause more memory allocation
and then investigate that within your app

wind dragon
#

Adding onto what fragly said, I can assure you that railway doesn't lie about metrics. Your bot's high memory usage may be due to caching or other unoptimized structures that are hogging your memory. I'd recommend taking a look at everything, including sweepers. Not sure what library you're working with but they are really important regardless. Memory leaks happen for a reason, so you should always do more investigating (including on your local machine) before jumping into conclusions.

This is just a piece of advice as I used to have similar issues in the past :)

plush pine
#

thank you dan, very well said!!

supple hazel
#

I didn’t say railway stats were lying

#

Just wondered why I got multiple result

supple hazel
wind dragon
supple hazel
#

Dude it’s so hard to find the cause

wind dragon
#

Last time I had a memory leak it was because of a deprecated function I forgot I had

wind dragon
supple hazel
#

Debug what

#

Heap snapshots don’t reveal anything

#

I don’t know what is taking so much memory

wind dragon
#

Are you testing on your local machine?

supple hazel
#

Uhhh I didn’t run my code enough locally to cause memory leak ig

#

I saw it on railway graphs

#

Like see an actual leak

#

I happens day by day or week by week

wind dragon
#

Then do that. It is way easier to debug something on your local machine compared to railway. Mess around with the bot, have task manager open and monitor the increase in system usage

#

Personally, I find memory leaks by enabling/disabling parts of my code that rely on memory. It might not be the best way but it works for me

supple hazel
#

Like this

#

Very slowly

supple hazel
wind dragon
#

I can't help much from here, but just try to mess around with stuff and determine the root cause

supple hazel
#

Interesting, locally running my health check command looks a lot different

#

There’s a lot of memory allocated but not used by heap thonk

#

Can this comment be correct?

plush pine
#

I'm really sorry but coding help is a bit out of scope of these threads, but Dan and fragly have already helped tremendously, please take their advice

supple hazel
#

How is is out of scope

#

I’m trying to find the cause or find a reason

plush pine
#

right but the cause or the reason will not have anything to do with railway

#

unfortunately we just can't offer programming help as these are forums for platform help

wind dragon
#
  • It should not be us telling you what to code, how to code it, etc. Not that it's bad thing, help is always good, but nobody here is familiar with your infrastructure besides you, and our input can possibly worsen things because we don't know the core of your project
plush pine
#

again, beautifully said

wind dragon
plush pine
#

no way it's perfect, both firm and caring

supple hazel
#

no one can help

#

there’s only you

plush pine
#

im sorry, but coding help is out of scope

supple hazel
#

Thanks for the info tho

#

so pls ban me