How to reduce memory usage


I’ve been using gitea since around version 1.5.0 and overtime the RAM usage kept increasing with each version; users and repository activity remained around the same.
Now as of version gitea alone is using >200MiB + an increase in MaraiDB’s mem usage; iirc correctly it was only half of that when I started using gitea. As I’m running gitea together with some other services on low memory hardware; this memory consumption has started to become problematic.

Is it possible to configure gitea in a way that reduces it’s memory usage (if possible without rebuilding the binary)? I do not need inbuilt SSH server; certbot and so on (though those are already disabled in the config)

Unrelated to my original question there seems to be a mem leak in 1.13.2:

Checking back a day after upgrading to 1.13.2, there seems to be some memory leak in this version.
Gitea’s memory usage has shot up to almost 500MiB (which is a lot for the hardware and degraded overall server performance) and every few minutes or so there’s an short burst in CPU usage. Will roll back to a prior version for now. (Disabled Gitea for now instead)
If this hasn’t been reported yet, please let me know what info you’d like to have regarding this issue.

My original question still applies though as the regular mem usage was already exceeding comfortable levels for a few versions without any mem leaks being involved.

Please change your default PASSWORD_HASH_ALGO to another one except argon2 .

Thanks for your reply!

I changed PASSWORD_HASH_ALGO to scrypt and started gitea again (this time 1.13.1).
Initially it now used 190MiB memory; but upon pushing a small 5 line diff, mem usage shot up to 587MiB (similar value to what 1.13.2 before) and stayed there. Handling the push also took unusually long. I therefore had to disable gitea again.

Any ideas what might be causing this? Do you need any more info about my system/setup and if so which?

Have you tried pbkdf2?

Thanks for the suggestion, I now tried again with pbkdf2. Unfortunately though, this didn’t improve much.

After startup finished mem usage initially was ~195MiB and seemingly stayed constant as long as I did not interact with it.
After a few hours I pushed the current HEAD to a new remote branch (no new commits, just a new reference), giteas mem usage immediately grew absurdly large to 525MiB. ~15min later gitea was still using as much memory and I had to disable it again.

Did you manage to hunt down the problem? I’ve got a similar issue where it takes a couple of hours of use to eat up 75% of the systems memory (2GiB memory, currently using SQLite DB, repos contain some large files). I’ve tried disabling caching and last commit caching to no avail.