Bug 181810

Summary: ktorrent > memory leaks after long usage
Product: [Applications] ktorrent Reporter: EsTaF <veranyon>
Component: generalAssignee: Joris Guisson <joris.guisson>
Status: RESOLVED FIXED    
Severity: normal CC: getaceres, jlp, kab-dmitrij, mrepinc
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: leakcheck.log

Description EsTaF 2009-01-24 21:39:48 UTC
Version:           3.1.5-r2 (using KDE 4.1.4)
Compiler:          Portage 2.1.6.4 (default/linux/amd64/2008.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.27-gentoo-r8 x86_64) 
OS:                Linux
Installed from:    Gentoo Packages

I'm opening the ktorrent and go to do my changes. After a few hours I'm watching the next image: there are around ~30% of memory use under ktorrent (by top). Then I'm closing that app and run again and watch that the ktorrent is using memory normally. around 5%. And so again and again. So I desided that problem.
I fell a fear when begin to write bugreports. I speak english not very well and never write bugreports.

My hardware:
AMD Athlon 3000+, nforce4 k8n neo4 (msi)/2 GB OZY (512MBx4), 3 hard disks. first ide (seagate) (my system here) and two sata. 200 and 500 GB.
I'm testing to stop a lot of my torrents and forsaking couple of it only, but I'm watching a simular problem. ktorrent is beginning to use memory very much.
Comment 1 Matej Repinc 2009-01-24 22:09:53 UTC
This is also happening to me. Current KTorrent memory consumption is ~350M, after a while (a day, half a day) the consumption becomes so high that it fills up all my RAM and also all of the swap, so my system freezes.
Running KTorrent version 3.1.5 with KDE 4.2 RC, both from Kubuntu binary packages.
Comment 2 EsTaF 2009-01-24 22:35:14 UTC
(In reply to comment #1)

When you had that one did you use kde"<" then 4.2 RC?

> This is also happening to me. Current KTorrent memory consumption is ~350M,
> after a while (a day, half a day) the consumption becomes so high that it fills
> up all my RAM and also all of the swap, so my system freezes.
> Running KTorrent version 3.1.5 with KDE 4.2 RC, both from Kubuntu binary
> packages.
> 

Or do you say about the ktorrent "bug" who was under kde 4.2 RC?
Comment 3 Matej Repinc 2009-01-24 23:04:01 UTC
I can't recall if the problem was also on KDE < 4.2 RC if you mean that. I think it started happening after upgrade of KTorrent to version 3.1.5, but don't take my word on that. Also, memory consumption went from 350 to 470M at the moment (in about 1h).
Comment 4 EsTaF 2009-01-24 23:15:28 UTC
(In reply to comment #3)
> I can't recall if the problem was also on KDE < 4.2 RC if you mean that. I
> think it started happening after upgrade of KTorrent to version 3.1.5, but
> don't take my word on that. Also, memory consumption went from 350 to 470M at
> the moment (in about 1h).
> 

was understand.. will waiting.. may will somebody of developers to see that bug. It's just really comfortable a torrent client. there're sorting by groups and it was do very nice.
is not wanting to go to another one
Comment 5 Joris Guisson 2009-01-25 10:41:19 UTC
Upgrade to 3.1.6, there have been some memory leaks fixed in that release.
Comment 6 Matej Repinc 2009-01-25 21:22:05 UTC
Installed 3.1.6 from Kubuntu binaries, looks like the problem remains.
Comment 7 EsTaF 2009-01-30 15:09:50 UTC
(In reply to comment #5)
> Upgrade to 3.1.6, there have been some memory leaks fixed in that release.
> 

No, it's not. a memory leaks effect is continuing
Comment 8 Matej Repinc 2009-01-30 21:37:52 UTC
Should I try to run KTorrent through a memory leak search program, such as valgrind? I tried, but didn't quite get the expected results (I ran it with 'valgrind --leak-check=full --log-file=/path/to/log/file ktorrent'), could you specify the correct way to do that, because this bug really annoys me and it would be super awesome if it would be fixed as soon as possible.
Comment 9 EsTaF 2009-01-31 16:01:38 UTC
(In reply to comment #8)
> Should I try to run KTorrent through a memory leak search program, such as
> valgrind? I tried, but didn't quite get the expected results (I ran it with
> 'valgrind --leak-check=full --log-file=/path/to/log/file ktorrent'), could you
> specify the correct way to do that, because this bug really annoys me and it
> would be super awesome if it would be fixed as soon as possible.
> 

I was running it. In progress.
As soon I had see something I'll posting it.
ok
Comment 10 EsTaF 2009-01-31 22:06:53 UTC
There's nothing. hmmm
But that one is bigger and bigger in the ram. I'm watching it by top

log:
==18324== Memcheck, a memory error detector.
==18324== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==18324== Using LibVEX rev 1878, a library for dynamic binary translation.
==18324== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==18324== Using valgrind-3.4.0, a dynamic binary instrumentation framework.
==18324== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==18324== For more details, rerun with: -v
==18324== 
==18324== My PID = 18324, parent PID = 16199.  Prog and args are:
==18324==    ktorrent
==18324==

for all there's nothing

yeahh.. or as speak English on the some forums - bam bam bam

Then for all I understand nothing. When I started ktorrent so it use 3% of ram. After an hour that one use around 7%. And now - around 20%
Comment 11 Joris Guisson 2009-02-01 11:59:59 UTC
If you want to run valgrind, then run it on 3.2rc1, seeing that there are not going to be any new releases in the 3.1 series. Also several leaks have been fixed in 3.2rc1 (some of them have been backported to 3.1.6).

Also to run :

valgrind --tool=memcheck --leak-check=full --log-file=leakcheck.log --show-reachable=yes -v /usr/bin/ktorrent --nofork
Comment 12 Matej Repinc 2009-02-01 14:21:48 UTC
Compiled 3.2 RC1 from sources, memory consumption is still very high, running ktorrent in valgrind at the moment...
EsTaF: are you using (K)Ubuntu? Because I have a feeling something is wrong with some Ubuntu packages, a friend of mine says that 3.2 RC1 on Gentoo has normal RAM usage.
Comment 13 EsTaF 2009-02-01 14:33:14 UTC
(In reply to comment #12)
> Compiled 3.2 RC1 from sources, memory consumption is still very high, running
> ktorrent in valgrind at the moment...
> EsTaF: are you using (K)Ubuntu? Because I have a feeling something is wrong
> with some Ubuntu packages, a friend of mine says that 3.2 RC1 on Gentoo has
> normal RAM usage.
> 

I'm use Gentoo. The version of valgrind is 3.4.0. isn't right version?  hmm..

Anyway, I'll retest it with that keys that you gave in your last post
Comment 14 EsTaF 2009-02-01 15:16:33 UTC
certianly, "I use Gentoo". not "I'm use Gentoo". It's my grammar. exuse me :)
Comment 15 EsTaF 2009-02-01 17:24:28 UTC
I do not know how i's important..:

==22701== My PID = 22701, parent PID = 16199.  Prog and args are:
==22701==    /usr/bin/ktorrent
==22701==    --nofork
==22701== 
--22701-- 
--22701-- Command line
--22701--    /usr/bin/ktorrent
--22701--    --nofork
--22701-- Startup, with flags:
--22701--    --tool=memcheck
--22701--    --leak-check=full
--22701--    --log-
Comment 16 EsTaF 2009-02-01 18:14:43 UTC
--22701-- REDIR: 0xcf34dd0 (memset) redirected to 0x4c22900 (memset)
--22701-- REDIR: 0xcf358d0 (memcpy) redirected to 0x4c23890 (memcpy)
--22701-- REDIR: 0xcf33ed0 (rindex) redirected to 0x4c223b0 (rindex)
--22701-- REDIR: 0xcf33ac0 (strlen) redirected to 0x4c22650 (strlen)
--22701-- REDIR: 0xc7eda20 (operator new(unsigned long)) redirected to 0x4c21ea0 (operator new(unsigned long))
--22701-- REDIR: 0xcf2ff50 (calloc) redirected to 0x4c20750 (calloc)
--22701-- REDIR: 0xcf302c0 (malloc) redirected to 0x4c21640 (malloc)
--22701-- REDIR: 0xcf30740 (realloc) redirected to 0x4c21700 (realloc)
--22701-- REDIR: 0xcf34c40 (memmove) redirected to 0x4c22950 (memmove)
--22701-- REDIR: 0xcf33d40 (strncmp) redirected to 0x4c226b0 (strncmp)
--22701-- REDIR: 0xcf33550 (strcmp) redirected to 0x4c22720 (strcmp)
--22701-- REDIR: 0xcf2e720 (free) redirected to 0x4c211c0 (free)
--22701-- REDIR: 0xc7edb40 (operator new[](unsigned long)) redirected to 0x4c21b20 (operator new[](unsigned long))
--22701-- REDIR: 0xc7ec840 (operator delete(void*)) redirected to 0x4c20e50 (operator delete(void*))
--22701-- REDIR: 0xffffffffff600400 (???) redirected to 0x3803b1ed (???)
--22701-- REDIR: 0xcf33590 (strcpy) redirected to 0x4c23b00 (strcpy)
--22701-- REDIR: 0xffffffffff600000 (???) redirected to 0x3803b1e3 (???)
--22701-- REDIR: 0xcf333a0 (index) redirected to 0x4c224a0 (index)
--22701-- REDIR: 0xcf34ee0 (mempcpy) redirected to 0x4c23130 (mempcpy)
--22701-- Reading syms from /usr/lib64/gconv/UTF-16.so (0xecdc000)
--22701--    object doesn't have a symbol table
--22701-- REDIR: 0xc7ec880 (operator delete[](void*)) redirected to 0x4c20a30 (operator delete[](void*))
--22701-- REDIR: 0xcf36650 (strchrnul) redirected to 0x4c229b0 (strchrnul)
--22701-- REDIR: 0xcef22d0 (unsetenv) redirected to 0x4c22a90 (unsetenv)
--22701-- REDIR: 0xcf33e30 (strncpy) redirected to 0x4c239f0 (strncpy)
Comment 17 EsTaF 2009-02-01 19:01:34 UTC
a full log:
==22701== Memcheck, a memory error detector.
==22701== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==22701== Using LibVEX rev 1878, a library for dynamic binary translation.
==22701== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==22701== Using valgrind-3.4.0, a dynamic binary instrumentation framework.
==22701== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==22701== 
==22701== My PID = 22701, parent PID = 16199.  Prog and args are:
==22701==    /usr/bin/ktorrent
==22701==    --nofork
==22701== 
--22701-- 
--22701-- Command line
--22701--    /usr/bin/ktorrent
--22701--    --nofork
--22701-- Startup, with flags:
--22701--    --tool=memcheck
--22701--    --leak-check=full
--22701--    --log-file=leakcheck.log
--22701--    --show-reachable=yes
--22701--    -v
--22701-- Contents of /proc/version:
--22701--   Linux version 2.6.27-gentoo-r8 (root@estaf) (gcc version 4.1.2 (Gentoo 4.1.2 p1.1)) #1 SMP Wed Jan 21 06:33:29 MSK 2009
--22701-- Arch and hwcaps: AMD64, amd64-sse2
--22701-- Page sizes: currently 4096, max supported 4096
--22701-- Valgrind library directory: /usr/lib64/valgrind
--22701-- Reading syms from /usr/bin/ktorrent (0x400000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/ld-2.6.1.so (0x4000000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/valgrind/amd64-linux/memcheck (0x38000000)
--22701--    object doesn't have a symbol table
--22701--    object doesn't have a dynamic symbol table
--22701-- Reading suppressions file: /usr/lib64/valgrind/default.supp
--22701-- Reading syms from /usr/lib64/valgrind/amd64-linux/vgpreload_core.so (0x4a1c000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so (0x4c1e000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libktcore.so.6.5.0 (0x4e27000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libbtcore.so.7.5.0 (0x5071000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/qt4/libQtSvg.so.4.4.2 (0x53a2000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/qt4/libQtCore.so.4.4.2 (0x55f6000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libpthread-2.6.1.so (0x5a17000)
--22701-- Reading syms from /usr/lib64/libkdecore.so.5.1.0 (0x5c32000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libSM.so.6.0.0 (0x6075000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libICE.so.6.3.0 (0x627e000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libX11.so.6.2.0 (0x649a000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXext.so.6.4.0 (0x67a3000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXft.so.2.1.2 (0x69b5000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXau.so.6.0.0 (0x6bc9000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXdmcp.so.6.0.0 (0x6dcc000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXpm.so.4.11.0 (0x6fd2000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/qt4/libQtGui.so.4.4.2 (0x71e3000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/qt4/libQtXml.so.4.4.2 (0x7cd2000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXtst.so.6.1.0 (0x7f1b000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXcursor.so.1.0.2 (0x8121000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXfixes.so.3.1.0 (0x832c000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXrender.so.1.3.0 (0x8532000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libkdeui.so.5.1.0 (0x873c000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libkio.so.5.1.0 (0x8cf2000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libphonon.so.4.2.0 (0x9179000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libknotifyconfig.so.4.1.0 (0x93c2000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/qca2/libqca.so.2.0.0 (0x95d5000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libkpty.so.4.1.0 (0x98e7000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libutil-2.6.1.so (0x9af1000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libutempter.so.1.1.5 (0x9cf4000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/qt4/libQt3Support.so.4.4.2 (0x9ef7000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libkfile.so.4.1.0 (0xa3f4000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libkde3support.so.4.1.0 (0xa678000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libkparts.so.4.1.0 (0xa978000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libstreamanalyzer.so.0.6.3 (0xabbd000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libstreams.so.0.6.3 (0xae37000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libz.so.1.2.3 (0xb06e000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libbz2.so.1.0.5 (0xb283000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libresolv-2.6.1.so (0xb493000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libsolid.so.4.1.0 (0xb6a7000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/qt4/libQtNetwork.so.4.4.2 (0xb92e000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libacl.so.1.1.0 (0xbc2f000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libattr.so.1.1.0 (0xbe37000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libkutils.so.4.1.0 (0xc03c000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/qt4/libQtDBus.so.4.4.2 (0xc287000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libgmp.so.3.4.4 (0xc4ed000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/gcc/x86_64-pc-linux-gnu/4.1.2/libstdc++.so.6.0.8 (0xc72e000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libm-2.6.1.so (0xca31000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libgcc_s.so.1 (0xccb2000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libc-2.6.1.so (0xcec0000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libpng12.so.0.34.0 (0xd1ff000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libXrandr.so.2.1.0 (0xd424000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libfreetype.so.6.3.18 (0xd62c000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libfontconfig.so.1.3.0 (0xd8bc000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/librt-2.6.1.so (0xdaec000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /lib64/libdl-2.6.1.so (0xdcf5000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/qt4/libQtSql.so.4.4.2 (0xdef9000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libxml2.so.2.7.2 (0xe137000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libdbus-1.so.3.4.0 (0xe47b000)
--22701--    object doesn't have a symbol table
--22701-- Reading syms from /usr/lib64/libexpat.so.1.5.2 (0xe6b8000)
--22701--    object doesn't have a symbol table
--22701-- REDIR: 0xcf34dd0 (memset) redirected to 0x4c22900 (memset)
--22701-- REDIR: 0xcf358d0 (memcpy) redirected to 0x4c23890 (memcpy)
--22701-- REDIR: 0xcf33ed0 (rindex) redirected to 0x4c223b0 (rindex)
--22701-- REDIR: 0xcf33ac0 (strlen) redirected to 0x4c22650 (strlen)
--22701-- REDIR: 0xc7eda20 (operator new(unsigned long)) redirected to 0x4c21ea0 (operator new(unsigned long))
--22701-- REDIR: 0xcf2ff50 (calloc) redirected to 0x4c20750 (calloc)
--22701-- REDIR: 0xcf302c0 (malloc) redirected to 0x4c21640 (malloc)
--22701-- REDIR: 0xcf30740 (realloc) redirected to 0x4c21700 (realloc)
--22701-- REDIR: 0xcf34c40 (memmove) redirected to 0x4c22950 (memmove)
--22701-- REDIR: 0xcf33d40 (strncmp) redirected to 0x4c226b0 (strncmp)
--22701-- REDIR: 0xcf33550 (strcmp) redirected to 0x4c22720 (strcmp)
--22701-- REDIR: 0xcf2e720 (free) redirected to 0x4c211c0 (free)
--22701-- REDIR: 0xc7edb40 (operator new[](unsigned long)) redirected to 0x4c21b20 (operator new[](unsigned long))
--22701-- REDIR: 0xc7ec840 (operator delete(void*)) redirected to 0x4c20e50 (operator delete(void*))
--22701-- REDIR: 0xffffffffff600400 (???) redirected to 0x3803b1ed (???)
--22701-- REDIR: 0xcf33590 (strcpy) redirected to 0x4c23b00 (strcpy)
--22701-- REDIR: 0xffffffffff600000 (???) redirected to 0x3803b1e3 (???)
--22701-- REDIR: 0xcf333a0 (index) redirected to 0x4c224a0 (index)
--22701-- REDIR: 0xcf34ee0 (mempcpy) redirected to 0x4c23130 (mempcpy)
--22701-- Reading syms from /usr/lib64/gconv/UTF-16.so (0xecdc000)
--22701--    object doesn't have a symbol table
--22701-- REDIR: 0xc7ec880 (operator delete[](void*)) redirected to 0x4c20a30 (operator delete[](void*))
--22701-- REDIR: 0xcf36650 (strchrnul) redirected to 0x4c229b0 (strchrnul)
--22701-- REDIR: 0xcef22d0 (unsetenv) redirected to 0x4c22a90 (unsetenv)
--22701-- REDIR: 0xcf33e30 (strncpy) redirected to 0x4c239f0 (strncpy)
Comment 18 EsTaF 2009-02-01 20:17:33 UTC
ls -l /usr/portage/dev-util/valgrind/
итого 36
-rw-r--r-- 1 portage portage 15465 Янв 13 20:35 ChangeLog
drwxr-xr-x 2 portage portage   248 Янв  5 22:37 files
-rw-r--r-- 1 portage portage  2209 Янв 13 20:35 Manifest
-rw-r--r-- 1 portage portage  1003 Окт 28  2004 metadata.xml
-rw-r--r-- 1 portage portage  3252 Авг 24 16:09 valgrind-3.3.1.ebuild
-rw-r--r-- 1 portage portage  3385 Дек 13 13:57 valgrind-3.3.1-r1.ebuild
-rw-r--r-- 1 portage portage  3255 Янв 13 20:35 valgrind-3.4.0.ebuild

I'll can create the ebuild of valgrind for version 3.2, but it will take a long time for me. If you're willing to wait, so it does not matter. I'll create it.

a version 3.2 - is it a really necessary one?
Comment 19 Jose 2009-02-01 21:08:36 UTC
I'm having the same problem with Kubuntu packages (KDE 4.2.0, KTorrent 3.1.6). It starts normal but when a few hours have passed, memory usage is about 500MB.
Comment 20 EsTaF 2009-02-01 23:58:46 UTC
the log wasn't changed. ktorrent is using 41% of ram now. When I started and wait around 30 minutes so it use 5% of ram.
I didn't add any torrent in it. I was just waiting.

not for claims. this is just "addons" to other information
Comment 21 EsTaF 2009-02-02 00:04:51 UTC
Created attachment 30845 [details]
leakcheck.log

also..
Comment 22 EsTaF 2009-02-02 00:06:22 UTC
be look. the log was changed
Comment 23 Joris Guisson 2009-02-02 10:40:05 UTC
Can you install debug packages and run again ?
Comment 24 EsTaF 2009-02-02 15:23:42 UTC
[ebuild   R   ] net-p2p/ktorrent-3.1.6  USE="bwscheduler infowidget ipfilter logviewer mediaplayer scanfolder search stats upnp webinterface -kdeprefix" LINGUAS="ru -ca -cs -da -de -el -es -et -fr -gl -it -ja -lv -nb -nds -nl -nn -pl -pt -pt_BR -sv -uk -zh_CN -zh_TW" 0 kB

Are you seying debug flag there? I'm not.
Comment 25 Matej Repinc 2009-02-02 17:42:49 UTC
Ran KTorrent 3.2 RC1 under valgrind, I'm not quite sure if the report is useful, will put it in the attachment anyway...
If you compile ktorrent with 'cmake . && make && sudo make install' does it compile in debug or release mode?
Comment 26 Matej Repinc 2009-02-02 17:53:20 UTC
Whoops, looks like the file is too big for Bugzilla to handle. Here's the link to the leakcheck log: http://paste.ubuntu.com:80/112857/
Comment 27 EsTaF 2009-02-02 19:36:04 UTC
(In reply to comment #25)
> Ran KTorrent 3.2 RC1 under valgrind, I'm not quite sure if the report is
> useful, will put it in the attachment anyway...
> If you compile ktorrent with 'cmake . && make && sudo make install' does it
> compile in debug or release mode?
> 
emerge --sync
eix -s ktorrent

..
[D] net-p2p/ktorrent
     Available versions:  
	(0)	2.2.7 2.2.8
	(3)	(~)3.1.5-r2 [M](~)3.2_beta1-r1
..
there's 3.2_[b]beta[/b]-r1

for notice: I won't install ktorrent directly anyway. Only Gentoo-way. with all ebuilds etc.
I could clone my system and install it directly, but then I restart my system and I can't do it.

Sorry
Comment 28 Joris Guisson 2009-02-04 18:25:51 UTC
Matej, are you sure this is 3.2rc1 ? I see a lot of stuff, which should be released at exit, but isn't and I don't see this when I run valgrind myself.
Comment 29 Joris Guisson 2009-02-04 18:30:52 UTC
Anyway the big leak is this :

==6122== 19,229,796 bytes in 1,216,678 blocks are definitely lost in loss record 994 of 994
==6122==    at 0x402505E: operator new[](unsigned) (vg_replace_malloc.c:268)
==6122==    by 0x4CFD482: qstrdup(char const*) (in /usr/lib/libQtCore.so.4.4.3)
==6122==    by 0x4CF16AA: qputenv(char const*, QByteArray const&) (in /usr/lib/libQtCore.so.4.4.3)
==6122==    by 0x4B66C10: KCatalogPrivate::setupGettextEnv() (kcatalog.cpp:139)
==6122==    by 0x4B66EB7: KCatalog::translateStrict(char const*) const (kcatalog.cpp:203)
==6122==    by 0x4B7D5D7: KLocalePrivate::translate_priv(char const*, char const*, char const*, unsigned long, QString*, QString*) const (klocale.cpp:764)
==6122==    by 0x4B7DBE0: KLocale::translateRaw(char const*, QString*, QString*) const (klocale.cpp:780)
==6122==    by 0x4B8942B: KLocalizedStringPrivate::toString(KLocale const*) const (klocalizedstring.cpp:245)
==6122==    by 0x4B8A343: KLocalizedString::toString() const (klocalizedstring.cpp:205)
==6122==    by 0x4AC20FD: i18n(char const*) (klocalizedstring.h:568)
==6122==    by 0x4B82676: KLocale::formatByteSize(double) const (klocale.cpp:1236)
==6122==    by 0x405794A: bt::BytesPerSecToString(double) (functions.cpp:263)
==6122== 

I'm gonna take a look at the kcatalog code
Comment 30 Joris Guisson 2009-02-04 18:37:27 UTC
OK, I think we can close this, because if you look at the commit log of :

http://websvn.kde.org/trunk/KDE/kdelibs/kdecore/localization/kcatalog.cpp?view=log

You will notice that the last commit says this :

Do not use qputenv, as it leaks memory.
Instead allocate environment string only once, use putenv,
and then just change the string.

So this is already fixed, but probably not in KDE 4.2 (it was committed on the 29th of january)

I'm gonna contact the guy who committed this and see if there is a workaround.
Comment 31 Matej Repinc 2009-02-04 19:55:15 UTC
Yup, I was running 3.2 RC. Thanks for digging into the problem, really appreciate it, I wouldn't want to lose my favorite torrent client because of a memory leak :)
Comment 32 Joris Guisson 2009-02-05 10:49:25 UTC
Just got back an answer. There are two ways around this problem :

One is to set LANGUAGE variable for KDE session to the language used in KDE.
E.g. to fr for French, de for German, etc. 

Another is to disable localization for KTorrent alone, through Help->Switch
Application Language... (disable localization = set language to US English)
The leaky code is then not triggered.

The fix will be part of KDE 4.2.1.

Comment 33 EsTaF 2009-02-05 10:57:11 UTC
(In reply to comment #32)
> Just got back an answer. There are two ways around this problem :
> 
> One is to set LANGUAGE variable for KDE session to the language used in KDE.
> E.g. to fr for French, de for German, etc. 
> 
> Another is to disable localization for KTorrent alone, through Help->Switch
> Application Language... (disable localization = set language to US English)
> The leaky code is then not triggered.
> 
> The fix will be part of KDE 4.2.1.
> 

http://pic.ipicture.ru/uploads/090205/IU7J0ZTbpb.jpg

And where is it? I'm speaking about the help dialog.
I can open settings dialog (network, files, plugins etc preferences) from system tray. There's icon of ktorrent. But not help dialog.
Comment 34 Matej Repinc 2009-02-06 20:13:32 UTC
(In reply to comment #32)
> Just got back an answer. There are two ways around this problem :
> 
> One is to set LANGUAGE variable for KDE session to the language used in KDE.
> E.g. to fr for French, de for German, etc. 
> 
> Another is to disable localization for KTorrent alone, through Help->Switch
> Application Language... (disable localization = set language to US English)
> The leaky code is then not triggered.
> 
> The fix will be part of KDE 4.2.1.
> 

This works for me. Thank you very much!
Comment 35 Joris Guisson 2009-03-25 09:10:14 UTC
*** Bug 188037 has been marked as a duplicate of this bug. ***