Bug 411493 - kwrite memory usage when opening a rather big file
Summary: kwrite memory usage when opening a rather big file
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: 19.08.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 413565 421935 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-09-01 11:09 UTC by Isaac
Modified: 2023-08-03 19:59 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
kwrite 20.08.2 CPU and memory usage (91.45 KB, image/png)
2020-10-31 09:35 UTC, Isaac
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Isaac 2019-09-01 11:09:47 UTC
SUMMARY

After opening a 144MB file in kwrite and browsing its contents kwrite starts to consume 100% CPU and all the available memory. See #410129

STEPS TO REPRODUCE
1. Open a big file in kwrite
2. Press Ctrl End

OBSERVED RESULT

One of my CPU cores stays at 100% usage. Kwrite memory usage is very high, reaching ~8GB when I killed it. You can see KSysGuard attachements with this info in #410129


EXPECTED RESULT

Browse file contents.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.16.4
KDE Frameworks Version: 5.61.0
Qt Version: 5.12.3

ADDITIONAL INFORMATION

-
Comment 1 Dominik Haumann 2019-09-02 08:35:58 UTC
Does the shell script contain i) binary data, and / or ii) very long text lines?
Comment 2 Isaac 2019-09-02 08:46:38 UTC
Yes, it has binary data and very long lines

$ wc -L SoapUI-x64-5.5.0.sh
862 SoapUI-x64-5.5.0.sh

$ file SoapUI-x64-5.5.0.sh 
SoapUI-x64-5.5.0.sh: POSIX shell script executable (binary data)
Comment 3 Justin Zobel 2020-10-30 00:41:38 UTC
I can't replicate this on kwrite built from kate git master.

Isaac, can you please retest and confirm if this is still an issue.
Comment 4 Isaac 2020-10-31 09:35:02 UTC
Created attachment 132904 [details]
kwrite 20.08.2 CPU and memory usage
Comment 5 Isaac 2020-10-31 09:43:13 UTC
Just tried again (20.08.02) and this time CPU only spiked when scrolling through the file. IMO memory usage is still huge as you can see in the attached screenshot: that ~4GB step was the memory used by kwrite.

Overall responsiveness is way better than when I opened this issue, but still system felt a bit laggy until I closed kwrite.

I'm currently using:

Operating System: KDE neon 5.20
KDE Plasma Version: 5.20.2
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.0
Kernel Version: 5.4.0-52-generic
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-8665U CPU @ 1.90GHz
Memory: 15,4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Comment 6 Justin Zobel 2020-11-01 01:17:24 UTC
Dominik does this extra info assist in diagnosing what might be causing this?
Comment 7 Christoph Feck 2020-11-09 23:50:53 UTC
Requested information was added with comment 5; changing status for inspection.
Comment 8 Christoph Cullmann 2020-12-15 20:32:46 UTC
*** Bug 413565 has been marked as a duplicate of this bug. ***
Comment 9 Christoph Cullmann 2020-12-15 22:01:08 UTC
*** Bug 421935 has been marked as a duplicate of this bug. ***
Comment 10 Christoph Cullmann 2023-08-03 19:59:36 UTC
We optimized some aspects, but large files still consume big chunks of memory.

If that should change, we need ideas and patches for that, otherwise we keep that as is, it is not unreasonable, we work well for the normal use cases.

https://kate-editor.org/post/2020/2020-07-18-contributing-via-gitlab-merge-requests/