Bug 243658

Summary: clear clipboard history doesn't release memory
Product: [Unmaintained] klipper Reporter: Xavier Brochard <xavier>
Component: generalAssignee: Esben Mose Hansen <kde>
Status: RESOLVED FIXED    
Severity: normal CC: adaptee, seleko, svn
Priority: NOR    
Version: 0.9.6   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In: 4.8
Sentry Crash Report:

Description Xavier Brochard 2010-07-05 15:16:54 UTC
Version:           0.9.6 (using KDE 4.4.1) 
OS:                Linux

Klipper's memory consumption increase when copying large amount of text. One may want to use the "clear clipboard history" menu to make some free memory. But it has no effect on memory used.


Reproducible: Always

Steps to Reproduce:
1. Create some very large, complicated documents. Spreadsheet with formulas and a lot of cells makes good candidates. 
2. Open a system activity monitor and monitor klipper memory usage. 
3. Copy the document, using different parts, until klipper increase its memory use to something like 15 MB or more (I've tested with memory used up to 500 MB!). 
4. Empty the clipbard history, using Klipper menu. Wait a few minutes, just in case. Check the memory used by klipper.


Actual Results:  
Klipper is still using the same amount of memory.
Repeating step 3 to 4 increase again the memory used, even if you copy only single words.


Expected Results:  
Free memory released

See also #235431

OS: Linux (x86_64) release 2.6.32-5-amd64
Compiler: cc
Comment 1 Jaka Kranjc 2011-08-17 13:29:14 UTC
Yeah, pretty unintuitive and inefficient. Looking at the details from the system monitor, the contents remain in the heap:

The process klipper (with pid 2058) is using approximately 352.2 MB of memory.
It is using 350.8 MB privately, and a further 7.9 MB that is, or could be, shared with other programs.

Private
358116 KB	[heap]
128 KB	/usr/share/fonts/TTF/DejaVuSans.ttf

Sounds like some objects are not destroyed soon enough. I hope it's not leaking pastes that go out of the queue.

KDE 4.7.0
Comment 2 Xavier Brochard 2011-08-17 16:10:53 UTC
This is a serious problem in professional context: I have several users using mainly Kmail, Konqueror and OpenOffice. They allways have multiple tabs opened in Konqui, multiple emails opens and they copy large amount of data between Konqui, emails and office documents. 
Memory consumption is the main reason of their Kde desktop being slow.
Comment 3 Jekyll Wu 2011-11-06 17:40:53 UTC
*** Bug 235431 has been marked as a duplicate of this bug. ***
Comment 4 Jekyll Wu 2011-12-22 20:30:44 UTC
Git commit 12e58a7d5a31eef9690089afa3a8d684b131f264 by Jekyll Wu.
Committed on 22/12/2011 at 21:23.
Pushed by jekyllwu into branch 'master'.

Fix memory leak when clearing and trimming clipboard history

BUG: 243658
FIXED-IN:4.8

M  +4    -0    klipper/history.cpp

http://commits.kde.org/kde-workspace/12e58a7d5a31eef9690089afa3a8d684b131f264
Comment 5 Jekyll Wu 2011-12-22 20:32:16 UTC
Git commit 729af3ec8d416964f46a70cd1fa7d59dbcc285f2 by Jekyll Wu.
Committed on 22/12/2011 at 21:23.
Pushed by jekyllwu into branch 'KDE/4.8'.

Fix memory leak when clearing and trimming clipboard history

BUG: 243658
FIXED-IN:4.8

M  +4    -0    klipper/history.cpp

http://commits.kde.org/kde-workspace/729af3ec8d416964f46a70cd1fa7d59dbcc285f2