Bug 509126 - Kate doesn't free up RAM for large files when closed
Summary: Kate doesn't free up RAM for large files when closed
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: application (other bugs)
Version First Reported In: 25.08.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-04 22:30 UTC by diversalizando
Modified: 2025-09-13 22:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 25.12.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description diversalizando 2025-09-04 22:30:15 UTC
I've been using Kate to open binaries and analyze the start and end for specific programming purposes. The files I open, for example, are .mp4s of a few GB. When I open the file, the RAM memory increases in size, but when I close the file, the memory is not released! This greatly affects the program's operation. Is it possible to allocate memory to disk instead of RAM?
Comment 1 Christoph Cullmann 2025-09-13 18:39:30 UTC
We do free memory, so far I know of no large leaks.

If you can profile it via heaptrack or valgrind and show a leak, we can take a look.

We will not implement own swapping :)
Comment 2 Waqar Ahmed 2025-09-13 19:50:09 UTC
Perhaps we can call malloc trim. Glibc malloc doesn't eagerly return memory to the OS.
Comment 3 Christoph Cullmann 2025-09-13 19:52:02 UTC
(In reply to Waqar Ahmed from comment #2)
> Perhaps we can call malloc trim. Glibc malloc doesn't eagerly return memory
> to the OS.

One can try that, Konsole has some parts that do that.
Comment 4 Christoph Cullmann 2025-09-13 20:15:50 UTC
I can take a look to add that.
Comment 5 Christoph Cullmann 2025-09-13 20:16:54 UTC
I will add it to the application, I don't want to do such stuff in the library, that could regress stuff for other applications using us.
Comment 6 Christoph Cullmann 2025-09-13 20:17:08 UTC
I will take a look.
Comment 7 Bug Janitor Service 2025-09-13 20:27:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1886
Comment 8 Christoph Cullmann 2025-09-13 20:34:47 UTC
Doing that now after document and project closing.
Comment 9 Christoph Cullmann 2025-09-13 21:30:20 UTC
Git commit dd79fc1bc2f643227b3af53b79fce235ea17c619 by Christoph Cullmann.
Committed on 13/09/2025 at 21:23.
Pushed by cullmann into branch 'master'.

use malloc_trim if available to free memory to the system

might avoid too large heap sizes in the long run

M  +3    -0    addons/project/kateprojectplugin.cpp
M  +5    -1    apps/lib/CMakeLists.txt
M  +3    -0    apps/lib/katedocmanager.cpp
M  +11   -0    apps/lib/ktexteditor_utils.cpp
M  +6    -0    apps/lib/ktexteditor_utils.h

https://invent.kde.org/utilities/kate/-/commit/dd79fc1bc2f643227b3af53b79fce235ea17c619
Comment 10 Christoph Cullmann 2025-09-13 22:00:06 UTC
Perhaps fixed in the next release.