summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-01-10 03:26:22 +0000
committerDavid Robillard <d@drobilla.net>2007-01-10 03:26:22 +0000
commit2d62ded1aa92b82d696fb37c952732ae1a309011 (patch)
tree656623bf94a288679250e1448e5aeb0c0050f19a
parent5c7a3c680b1dc09bda55401b18d27b98f3b312cb (diff)
Reduced allocated stack sizes. Trims about 13MB of memory consumption.
git-svn-id: svn://localhost/ardour2/trunk@1293 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--SConstruct2
-rw-r--r--gtk2_ardour/editor_ops.cc6
-rw-r--r--libs/ardour/audioengine.cc3
-rw-r--r--libs/ardour/osc.cc5
-rw-r--r--libs/pbd/pthread_utils.cc14
5 files changed, 29 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index 1b04306efb..2be154afbf 100644
--- a/SConstruct
+++ b/SConstruct
@@ -837,6 +837,8 @@ if env['SYSLIBS']:
# libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
libraries['soundtouch'] = LibraryInfo()
libraries['soundtouch'].ParseConfig ('pkg-config --cflags --libs soundtouch-1.0')
+ # Comment the previous line and uncomment this for Debian:
+ #libraries['soundtouch'].ParseConfig ('pkg-config --cflags --libs libSoundTouch')
libraries['appleutility'] = LibraryInfo(LIBS='libappleutility',
LIBPATH='#libs/appleutility',
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index e4de1c1e2e..a84832d73e 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -2779,9 +2779,15 @@ Editor::freeze_route ()
itt.done = false;
itt.cancel = false;
itt.progress = 0.0f;
+
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, 500000);
pthread_create (&itt.thread, 0, _freeze_thread, this);
+ pthread_attr_destroy(&attr);
+
track_canvas.get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH));
while (!itt.done && !itt.cancel) {
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 128fc37eb1..ab08423c31 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -399,7 +399,8 @@ void
AudioEngine::start_metering_thread ()
{
if (m_meter_thread == 0) {
- m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread), true);
+ m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread),
+ 500000, true, true, Glib::THREAD_PRIORITY_NORMAL);
}
}
diff --git a/libs/ardour/osc.cc b/libs/ardour/osc.cc
index c43f254f6f..c3e9147152 100644
--- a/libs/ardour/osc.cc
+++ b/libs/ardour/osc.cc
@@ -199,10 +199,15 @@ OSC::init_osc_thread ()
return false;
}
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, 500000);
+
pthread_create (&_osc_thread, NULL, &OSC::_osc_receiver, this);
if (!_osc_thread) {
return false;
}
+ pthread_attr_destroy(&attr);
//pthread_detach (_osc_thread);
return true;
diff --git a/libs/pbd/pthread_utils.cc b/libs/pbd/pthread_utils.cc
index db242cea7b..3408f2c0b7 100644
--- a/libs/pbd/pthread_utils.cc
+++ b/libs/pbd/pthread_utils.cc
@@ -43,6 +43,16 @@ pthread_create_and_store (string name, pthread_t *thread, pthread_attr_t *attr,
{
int ret;
+ pthread_attr_t default_attr;
+ bool use_default_attr = (attr == NULL);
+
+ if (use_default_attr) {
+ // set default stack size to sensible default for memlocking
+ pthread_attr_init(&default_attr);
+ pthread_attr_setstacksize(&default_attr, 500000);
+ attr = &default_attr;
+ }
+
if ((ret = pthread_create (thread, attr, start_routine, arg)) == 0) {
std::pair<string,pthread_t> newpair;
newpair.first = name;
@@ -53,6 +63,10 @@ pthread_create_and_store (string name, pthread_t *thread, pthread_attr_t *attr,
pthread_mutex_unlock (&thread_map_lock);
}
+
+ if (use_default_attr) {
+ pthread_attr_destroy(&default_attr);
+ }
return ret;
}