Defect #44766
openMemory leak in redmine 7.x.x + out of memory crash
Description
Hello,
for a few months redmine has started to crash when running with 4GB memory:
State: Running
Started: Thu, 19 Nov 2026 09:42:23 +0100
Last State: Terminated
Reason: OOMKilled
Exit Code: 137
Started: Tue, 17 Nov 2026 10:28:49 +0100
Finished: Thu, 19 Nov 2026 09:42:22 +0100
At the moment I am running 7.0.3, but from the history it seems like the leak was introduced some time around 7.x series start. This redmine deploy is based on something a bit older than redmine 4.2.3, but has been upgraded along the years. About says:
ruby bin/about no username found, using 'root@redmine-ungleich-redmine-559f7499d6-tth9m' instead sh: cvs: not found Environment: Redmine version 7.0.3.stable Ruby version 4.0.9-p0 (2026-10-23) [x86_64-linux-musl] Rails version 8.1.4 Environment production Database adapter PostgreSQL Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp Redmine settings: Redmine theme Default SCM: Subversion 1.14.5 Mercurial 7.2.4 Bazaar 3.3.15 Git 2.54.0 Filesystem Redmine plugins: no plugin installed
The typical memory curve I have attached as a screenshot:

I don't see anything jumping at me in the logs, just regular requests.
Files
Updated by Jakob Neumann 11 days ago
- File Skärmavbild 2026-11-25 kl. 15.28.21.png Skärmavbild 2026-11-25 kl. 15.28.21.png added
- File Skärmavbild 2026-11-25 kl. 15.30.44.png Skärmavbild 2026-11-25 kl. 15.30.44.png added
We're having the same issue in our instance since we updated from 5.x to 7.x, worker memory is climbing up until it crashes
Updated by Katsuya HIDAKA 10 days ago
I found a memory leak in the code that adds copy buttons to code blocks. It may be related to this issue. I've posted the details and a patch in #44800.
Updated by Nico Schottelius 9 days ago
I've just updated our redmine deployment to have 8GB of main memory and it certainly, very stable leaks memory:

We are not at roughly 6GB, so the next crash is due in a few days. I am not sure if the cause is the one found in #44800, because the memory leak seems to grow without (human) interaction. It might be crawlers running against redmine though..
Is there any easy way to query a running redmine instance as to where the memory is allocated? I've maybe 2 days left until the next crash, so maybe I can get the stats.
Updated by Nico Schottelius 9 days ago
Wrong image in the last comment, right one is:

Updated by Go MAEDA 8 days ago
Nico Schottelius wrote in #note-3:
I am not sure if the cause is the one found in #44800, because the memory leak seems to grow without (human) interaction.
Nico, thank you for the additional information.
The leak described in #44800 does not require any human interaction. It occurs on the server each time Redmine renders text that contains a code block. Clicking the copy button is not involved.
This means that memory also grows when crawlers visit issues or wiki pages that contain code blocks, and when feed readers fetch Atom feeds. I think this matches what you are seeing.
@hidakatsuya has already provided a patch in #44800, and it is a one-line change. Could you please apply it and see whether the memory usage still grows? I think that is the quickest way to find out whether it fixes the problem on your instance.