# How to reduce memory usage

**URL:** <https://forum.gitea.com/t/how-to-reduce-memory-usage/2947>\
**Category:** Install/Maintain/Configure\
**Created:** [February 5, 2021, 8:03pm UTC](https://forum.gitea.com/t/how-to-reduce-memory-usage/2947 "2021-02-05T20:03:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phynf](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Phynf](https://forum.gitea.com/u/Phynf)\
**Post date:** [February 5, 2021, 8:03pm UTC](https://forum.gitea.com/t/how-to-reduce-memory-usage/2947/1 "2021-02-05T20:03:08Z")

</div>

Hi,

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 1.1.3.2 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)_

---

<div class="post-metadata">

**Author:** ![Phynf](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Phynf](https://forum.gitea.com/u/Phynf)\
**Post date:** [February 6, 2021, 1:11am UTC](https://forum.gitea.com/t/how-to-reduce-memory-usage/2947/2 "2021-02-06T01:11:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lunny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/lunny/32/4701_2.png) [@lunny](https://forum.gitea.com/u/lunny)\
**Post date:** [February 8, 2021, 7:59am UTC](https://forum.gitea.com/t/how-to-reduce-memory-usage/2947/3 "2021-02-08T07:59:09Z")

</div>

Please change your default PASSWORD\_HASH\_ALGO to another one except argon2 .

---

<div class="post-metadata">

**Author:** ![Phynf](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Phynf](https://forum.gitea.com/u/Phynf)\
**Post date:** [February 9, 2021, 9:05pm UTC](https://forum.gitea.com/t/how-to-reduce-memory-usage/2947/4 "2021-02-09T21:05:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![lunny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/lunny/32/4701_2.png) [@lunny](https://forum.gitea.com/u/lunny)\
**Post date:** [February 18, 2021, 2:03am UTC](https://forum.gitea.com/t/how-to-reduce-memory-usage/2947/5 "2021-02-18T02:03:21Z")

</div>

Have you tried `pbkdf2`?

---

<div class="post-metadata">

**Author:** ![Phynf](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Phynf](https://forum.gitea.com/u/Phynf)\
**Post date:** [February 26, 2021, 3:47am UTC](https://forum.gitea.com/t/how-to-reduce-memory-usage/2947/6 "2021-02-26T03:47:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bytesnz](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@bytesnz](https://forum.gitea.com/u/bytesnz)\
**Post date:** [November 5, 2022, 10:33am UTC](https://forum.gitea.com/t/how-to-reduce-memory-usage/2947/7 "2022-11-05T10:33:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lunny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/lunny/32/4701_2.png) [@lunny](https://forum.gitea.com/u/lunny)\
**Post date:** [September 24, 2023, 8:13am UTC](https://forum.gitea.com/t/how-to-reduce-memory-usage/2947/8 "2023-09-24T08:13:43Z")

</div>

Closed on September 24, 2023, 8:13am UTC


