Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: [PATCH] Automatically cleanup exited threads to fixmemory leak



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Klaus Schmidinger wrote:
| Jon Burgess wrote:
|
|>I have noticed for a while that the virtual memory usage of the VDR
|>process grows by 16Mb for each channel switch. I can see this reflected
|>in the top "size" field for the VDR process. After a large amount of
|>channel switches the process would exhaust all of its virtual memory
|>allowance and need to be restarted.
|
|
| I can't confirm this on my machine. The memory footprint of VDR
| remains
| pretty much constant when switching through channels, even in Transfer
Mode
| (which is where threads are started/stopped with every channel switch).
|
| Are you using VDR with any other patches or plugins?
| If so, do you have the same problem with plain vanilla VDR?
| Is your system using NPTL?

Hello Klaus!

Is NPTL the way to go? I'm asking because I'm recompiling glibc right
now and I have not started the emerge with NPTL support enabled. Should
I stop and change it?

Thx
Sebastian
|
| Klaus
|
|
|>I have found that the cause of this leak is that the VDR threads which
|>are restarted when changing channels do not get cleaned up properly. The
|>exited threads hang around until something reads the exit status,
|>exactly analogous to "zombie" child processes.
|>
|>I noticed that nowhere in the thread code do we deal with reading the
|>thread exit status. I think the easiest fix is to just detach all the
|>threads so that they are automatically cleaned up as soon as they finish.
|>
|>The patch attached works for me with vdr-1.3.3. It probably works for
|>1.2.x as well, but I have not tried it.
|>
|> Jon
|>
|>
- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|>--- thread.c~ 2004-01-03 16:59:33.000000000 +0000
|>+++ thread.c 2004-02-07 02:09:49.488977688 +0000
|>@@ -199,6 +199,7 @@
|> running = true;
|> parentTid = pthread_self();
|> pthread_create(&childTid, NULL, (void *(*) (void
*))&StartThread, (void *)this);
|>+ pthread_detach(childTid); /* Auto-reap */
|> pthread_setschedparam(childTid, SCHED_RR, 0);
|> usleep(10000); // otherwise calling Active() immediately after
Start() causes a "pure virtual method called" error
|> }
|
|
|


- --
Public Key auf -> pgp.mit.edu <-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAJiymBmWDfd/NnGIRAi+wAKDVGdHaZlxqRaQSV6TqG7uoythSqQCggmOa
Qz6V6U2sib1Q53Knv4js25o=
=VBou
-----END PGP SIGNATURE-----


--
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index