This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Memory usage (feature request)

Tags: None
(comma "," separated)
alanic
Registered Member
Posts
15
Karma
0

Memory usage (feature request)

Thu Dec 22, 2005 1:13 am
I'm using the SVN version (upadted and recompiled yesterday) and with large torrents it uses a lot of memory. I don't think it's because of a memory leak because it's like that right after start. So with a 1gig ram PC it's so hard to download a couple of large torrents(~2gb).

I was wondering if you guys could take this into account and make it use less memory. I don't know the internals but one possible improvement I think is this (feature request):

Whether I try to download the entire torrent or just some files in it, it uses the same amount of memory. It would be very useful if it uses less memory when we want it to download only a part of the torrent. Could this be possible? Because right now there is no way to download large torrents without having crashes and/or using the whole memory and a lot of swap space. If we could download them file by file while using less resources it would be much better.

Thanks.
alanic
Registered Member
Posts
15
Karma
0

Thu Dec 22, 2005 2:42 am
And another thing: I have many large torrents in my list, and only some of them are started, the others are stopped because of memory considerations. Now if I exit the program and run it again, it tries to start all the downloads I have, which kills my system. I wish it would remember which downloads were stopped in the last session and wouldn't try to start them when rerun. Currently I am setting max downloads to 1 before exiting to overcome this problem.

And here is my version info:

Qt: 3.3.4
KDE: 3.4.3
KTorrent: 1.2dev

Thanks.
imported4-Ivan
Registered Member
Posts
819
Karma
0

Thu Dec 22, 2005 5:47 pm
First of all, Joris is working on fix for resource usage so we all hope this will be finished soon.

Large torrents download, with fast download speed can make somewhat more chunks in download queue than it should. This can be a problem if chunks are big as someone already reported.

If you are experiencing increased memory usage right on download start (with zero bytes downloaded), this won't be good. But if you have increased memory usage after starting some paused/stopped torrent than this is a known problem and should be fixed soon. Can you tell me exactly how much RAM does KT use when starting only one torrent from scratch?


Another thing, are you sure KT doesn't remember which torrents are started/stopped on restart? It should work. Also, make sure you exit KT normally - it won't remember a thing when it crashes.
George
Moderator
Posts
5421
Karma
1

Thu Dec 22, 2005 5:50 pm
It does remember which torrents are stopped.

Take a look in the directory where all the temporary stuff get stored, it should have subdirectories named tor0, tpr1, tor2, ... One for each torrent.

If a torrent is stopped the torX dir of that torrent should contain an empty file named stopped.

As for the memory usage, we are working on that right now.
alanic
Registered Member
Posts
15
Karma
0

Sat Dec 24, 2005 11:34 pm
Thanks for the great replies. Ok, it does remember stopped downloads when properly shut down. I was probably checking it after it crashed.
I have been seeing high memory usage after resuming huge torrents. I tried adding a huge torrent and it didn't really change the memory usage, there was around a 10mb change in mem usage. Then I removed it.
Here are the sizes of my current torrents, percentage of completion and the memory usage:
(I exited ktorrent with a 1gig swap space, I tried to run it again twice but it crashed. I increased the swap to 2 gig and it worked)
~$ sync
~$ free
total used free shared buffers cached
Mem: 1002420 920680 81740 0 7456 654168
-/+ buffers/cache: 259056 743364
Swap: 2097144 0 2097144
~$ date
Sat Dec 24 16:50:34 CST 2005
~$ free
total used free shared buffers cached
Mem: 1002420 990288 12132 0 6316 179828
-/+ buffers/cache: 804144 198276
Swap: 2097144 1481500 615644
~$ date
Sat Dec 24 16:56:15 CST 2005


Image

Btw, I'm a programmer, wrote some Qt applications for work and I'd like to contribute to a couple of KDE projects as I can find time. I tried to get started in the past but since I wasn't using the SVN versions of everything I ran into incompatibility problems. It's nice that SVN version of ktorrent worked with my kubuntu breezy right away. Do you guys have any recommendations to make the process of running SVN versions and contributing with patches easier? Should I have one stable KDE tree for my general use and one for development? If so, how? Do you have any distribution preferences for it (Gentoo)?

Keep up the good work, I can't wait for that memory fix!
George
Moderator
Posts
5421
Karma
1

Tue Dec 27, 2005 12:08 pm
I think I accidently missed that last post of yours, so I apologize for the late reply.

We use a stable KDE version to develop against (currently 3.5). I'm using kubuntu 5.10 (I don't know if thats breezy or hoary).

Most of the memory leaks should be fixed now, the only ones left seem to be in libraries KT uses. If you update to the latest svn, you can verify this for yourself :

./configure --enable-memleak-check
touch apps/ktorrent/leaktrace.cpp (so that this file recompiles)
make

After that, when you run KT, you will find a list of leaks printed to the console, and a file named leak.out. You can then see where the leaks happened, by using the leak-analyze script :

leak-analyze /path/to/ktorrent/executable leak.out

The leak-analyze script can be found here :
http://www.andreasen.org/LeakTracer/

Look for the archive LeakTracer.tar.gz, it is in there.

LeakTracer had some disadvantages, so I had to make my own memory leak tracer, but I'm still using their output format and script. The script is actually pretty clever, it uses gdb to find out the exact location of the leak..

It also would be wise to run make install before you run leak-analyze, libtool uses some script hackery so that you can run ktorrent from the build directory without having to install libktorrent. The actual executable is in a hidden directory named .libs, but if you pass this to leak-analyze, it will not find libktorrent, so the easiest way is to do a make install and then do leak-analyze /usr/bin/ktorrent leak.out
alanic
Registered Member
Posts
15
Karma
0

Thu Jan 05, 2006 7:09 am
Sweet. Thank you.


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]