make the art thread pool use the exact stack_size
There have been some scenarios not using the default-sized stack,
which may be 64K(e.g. https://android.googlesource.com/platform/art/+/refs/heads/master/runtime/runtime.cc#1058)
using the exact stack_size to save process memory.
Signed-off-by: eric.yan <eric.yan@oneplus.com>
Change-Id: I3fe31a8b152a982b35cfe2f0b967a43e01320a14
diff --git a/runtime/thread_pool.cc b/runtime/thread_pool.cc
index 50f5eeb..f991c05 100644
--- a/runtime/thread_pool.cc
+++ b/runtime/thread_pool.cc
@@ -74,6 +74,8 @@
CHECK_PTHREAD_CALL(pthread_attr_init, (&attr), reason);
if (kUseCustomThreadPoolStack) {
CHECK_PTHREAD_CALL(pthread_attr_setstack, (&attr, stack_.Begin(), stack_.Size()), reason);
+ } else {
+ CHECK_PTHREAD_CALL(pthread_attr_setstacksize, (&attr, stack_size), reason);
}
CHECK_PTHREAD_CALL(pthread_create, (&pthread_, &attr, &Callback, this), reason);
CHECK_PTHREAD_CALL(pthread_attr_destroy, (&attr), reason);