Author: titmuss
Date: Fri Nov 14 14:41:54 2008
New Revision: 3378
URL: http://svn.slimdevices.com?rev=3378&root=Jive&view=rev
Log:
Bug: 9984
Description:
Reduce the pthread stack sizes, that reduces memory usage on the Controller
from
90% -> 40%. Whoo!.
Modified:
7.3/trunk/squeezeplay/src/SDL-1.2.13/src/thread/pthread/SDL_systhread.c
7.3/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c
Modified:
7.3/trunk/squeezeplay/src/SDL-1.2.13/src/thread/pthread/SDL_systhread.c
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/SDL-1.2.13/src/thread/pthread/SDL_systhread.c?rev=3378&root=Jive&r1=3377&r2=3378&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/SDL-1.2.13/src/thread/pthread/SDL_systhread.c
(original)
+++ 7.3/trunk/squeezeplay/src/SDL-1.2.13/src/thread/pthread/SDL_systhread.c Fri
Nov 14 14:41:54 2008
@@ -52,6 +52,7 @@
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
{
pthread_attr_t type;
+ size_t stacksize;
/* Set the thread attributes */
if ( pthread_attr_init(&type) != 0 ) {
@@ -59,6 +60,10 @@
return(-1);
}
pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE);
+
+ /* set stack size to 64k */
+ stacksize = 64 * 1024;
+ pthread_attr_setstacksize(&type, stacksize);
/* Create the thread and go! */
if ( pthread_create(&thread->handle, &type, RunThread, args) != 0 ) {
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c?rev=3378&root=Jive&r1=3377&r2=3378&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c
(original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c Fri
Nov 14 14:41:54 2008
@@ -446,6 +446,7 @@
int err;
pthread_attr_t thread_attr;
struct sched_param thread_param;
+ size_t stacksize;
if ((err = snd_output_stdio_attach(&output, stdout, 0)) < 0) {
DEBUG_ERROR("Output failed: %s", snd_strerror(err));
@@ -467,6 +468,11 @@
if ((err = pthread_attr_setdetachstate(&thread_attr,
PTHREAD_CREATE_DETACHED)) != 0) {
DEBUG_ERROR("pthread_attr_setdetachstate: %s", strerror(err));
return 0;
+ }
+
+ stacksize = 32 * 1024; /* 32k stack, we don't do much here */
+ if ((err = pthread_attr_setstacksize(&thread_attr, stacksize)) != 0) {
+ DEBUG_ERROR("pthread_attr_setstacksize: %s", strerror(err));
}
if ((err = pthread_create(&audio_thread, &thread_attr,
audio_thread_execute, NULL)) != 0) {
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins