Can you fix memory usage?


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!


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.


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


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.


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


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.


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.


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


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.


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


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


So you can tell , how glitch collect memory usage?


See my response: Can you fix memory usage?