Stupid problem with project's memory

Project’s name: shadbot.
It is a discord bot which is saving some data to a file called “servers”. it is about a couple of mb (I deleted it completely in hope of running git gc but no hope), but every time the bot is writing it (using fs), the memory waste gets larger and larger, going exponentially up.
What I guess is that everytime fs is saving the file, another copy of the file is created AND IS NOT CLEARED ANYTIME. I can’t fucking sit here and run git gc every hour, come on. If that’s the issue, why are these temporary files not cleared? This is the second time the memory gets completely full and I can’t do shit. Please send help, which will last for more than 1 day.
Sincerely

Hi Supahero!

  1. If you are going to be writing and rewriting a file in the filesystem which is not in .data or otherwise .gitignored, then the Git repo will also track the previous versions of the file. Git’s delta-encoding is more effective for files like code, which are mostly text and mostly remain the same from one version to the next; it is not recommended for binary files.

  2. Even that (1) were the problem, you would see warnings about the container being low on disk, not memory. It’s entirely possible to have a memory leak bug, which would explain warnings about the container being low on memory. Memory leak bugs can be tricky, and I don’t have any both quick and easy recommendations for addressing them. It might be reasonable to use a Sqlite database (keeping the database in .data/ directory) like ~hello-sqlite does. It might be reasonable to work incrementally, testing for memory leaks at each step.

Hope this helps,

Johnicholas

I meant disk memory through memory, though I find the first piece of information very helpful. Now I only need a couple of addicional MB on the disk to be able to run git gc and then I will add the file to .gitignore. Thanks!
@glitch_support Can I get some addicional space for my project please? I only need as much as git gc needs. Project’s name: shadbot.

Hi @supahero!

Please contact support@glitch.com, using the email that is associated with your Glitch account, and ask them for a temporary increase in disk space for your project :slight_smile:

Cheers
Mads