Reduce runtime thread pool stack size
Reduce the size to 64k to avoid using as much virtual address space.
Bug: 116052292
Test: test-art-host
Change-Id: I370cfb6c8f7060b674e5bc67a0b85ac7adf46041
diff --git a/runtime/thread_pool.cc b/runtime/thread_pool.cc
index 8723c99..0f96510 100644
--- a/runtime/thread_pool.cc
+++ b/runtime/thread_pool.cc
@@ -123,7 +123,10 @@
tasks_.clear();
}
-ThreadPool::ThreadPool(const char* name, size_t num_threads, bool create_peers)
+ThreadPool::ThreadPool(const char* name,
+ size_t num_threads,
+ bool create_peers,
+ size_t worker_stack_size)
: name_(name),
task_queue_lock_("task queue lock"),
task_queue_condition_("task queue condition", task_queue_lock_),
@@ -137,15 +140,13 @@
creation_barier_(num_threads + 1),
max_active_workers_(num_threads),
create_peers_(create_peers) {
- Thread* self = Thread::Current();
while (GetThreadCount() < num_threads) {
const std::string worker_name = StringPrintf("%s worker thread %zu", name_.c_str(),
GetThreadCount());
- threads_.push_back(
- new ThreadPoolWorker(this, worker_name, ThreadPoolWorker::kDefaultStackSize));
+ threads_.push_back(new ThreadPoolWorker(this, worker_name, worker_stack_size));
}
// Wait for all of the threads to attach.
- creation_barier_.Wait(self);
+ creation_barier_.Wait(Thread::Current());
}
void ThreadPool::SetMaxActiveWorkers(size_t threads) {