Bug 250617 - memory leak probably somewhere in kdelibs "/interfaces/ktexteditor/" or "kparts" leads to complete alloc when loading or inserting bigger files
Summary: memory leak probably somewhere in kdelibs "/interfaces/ktexteditor/" or "kpar...
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: unspecified
Platform: OpenSUSE Linux
: NOR normal with 10 votes (vote)
Target Milestone: ---
Assignee: KWrite Developers
Depends on:
Reported: 2010-09-09 01:50 UTC by Daniel Frenzel
Modified: 2011-01-03 03:58 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Frenzel 2010-09-09 01:50:52 UTC
Version:           unspecified (using KDE 4.5.0) 
OS:                Linux

for example:
when i open a 3,3 mb file kwrite allocs + ~19 mb. when i insert (copy & paste) ~30 mb each 3.3 mb
scrolling will enhance the effect. so for testing i opened and scrolled an 18 mb file. result: 200 mb memory allocated. if you try to open even bigger files (>30) i could allocate some gigybytes of system memory and will lead the system to crash.
problem is reproducable in kde 4.4 (opensuse 11.3 stable) and in kde 4.5.1.

also some parts of the kdelibs are a mess. and the mass of senseless new's should force the use of valgrind....

Reproducible: Always

Steps to Reproduce:
system: 3gb ram
create ~18 mb file ==> load (some houndreds of mb allocated)
copy text and paste to file end ==> kwrite should hang some time whyle messing the systems ram
if file is too big kde will hang too
Comment 1 Milian Wolff 2010-09-09 14:18:15 UTC
This is not a memory leak, but just the fact that Kate is not designed to handle such big files.

I'm pretty sure there is also another "bugreport" about this, where Christoph said that it is possible to improve the situation, but he has no urge to fix it himself (yet?).
Comment 2 Daniel Frenzel 2010-09-09 17:42:37 UTC
i think the basic design of some parts of the kdelibs are the problem (kwrite/kate are using them). while working with text, there never happens a release of memory. this might be not a problem with small files, but a big when files grow bigger. 
im not totally sure how the library is doing all the stuff kwrite has to handle with. but at least it should be possible to save 3,3 mb of ascii signs in 3,3 megaBYTES in memory instead alloc 20mb and at least the lib has to free memory if the user is deleting text or release a selection. 
im pretty sure if this would be possible with a small fix, someone already did this. so keep in mind for future releases. qt has something like an garbage collector, but this collector cant work while the program is running.
Comment 3 Christopher Yeleighton 2011-01-03 03:58:18 UTC
When I tell KWrite to open the file <URL: http://ftp.mozilla.org/pub/mozilla.org/data/reporter.mozilla.org/reporter_mozilla_org_anonymized.sql.gz >, KWrite allocates up to 700MB of system memory and then the process just silently dies; no window appears.
How is this bug INVALID?  KDE is unable to display files that GNU less displays like a snap!  And silently crashing because of memory is unacceptable; at the very least, KWrite should be able to say "Sorry, this file is too big".