Can you fix memory usage?


#1

Glitch is showing wrong memory usage. Glitch is showing my memory usage is 400mb but actually my bot is using just 180mb as an average. Also make it so that my project don’t get stopped at 400mb+ usage only. It should stop at 500mb usage. Please fix the status!


#2

This doesn’t mean the memory usage is incorrect, there is a short delay between what’s used and what gets displayed. Also the display is updated periodically so some peaks and troughs can get missed. It’ll be a short spike of high usage triggering the project to be stopped, which won’t necessarily get displayed.


#3

Still memory usage shown is double my bot memory usage???


#4

Where are you getting your usage data from? Also, you said 180mb is the average. The average doesn’t matter, it’s a limit on the total usage at any time.


#5

I am getting Usage by this code
process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)


#6

I’ll clarify how what we’re reporting differs from process. The folks I need to speak to about this aren’t in today, so it will be next week.


#7

So the difference occurs because process.memoryUsage() only returns the memory usage for the node process on which it is called, whereas we display the entire container memory usage in the editor. Plus, you’re only looking at the heap.


#8

Oh btw my project is stopped how do i fix it :sob::sob::sob:


#9

You can run refresh from the console or make an edit to package.json which will force a restart unless using watch.json with particular settings.


#10

Why not you make it restart automatically? How can i make it restart automatically?


#11

My recommendation would be to fix the memory usage issue so it doesn’t need to restart at all.


#12

So you can tell , how glitch collect memory usage?


#13

See my response: Can you fix memory usage?