Skip to content

Commit

Permalink
Testing stack size.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpldgr committed Nov 10, 2024
1 parent f412240 commit 2e1bc18
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/thread_win32_osx.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define THREAD_WIN32_OSX_H_INCLUDED

#include <thread>
#include <iostream>

/// On OSX threads other than the main thread are created with a reduced stack
/// size of 512KB by default, this is too low for deep searches, which require
Expand All @@ -33,7 +34,7 @@

namespace Stockfish {

static const size_t TH_STACK_SIZE = 8 * 1024 * 1024;
static const size_t TH_STACK_SIZE = 32 * 1024 * 1024;

template <class T, class P = std::pair<T*, void(T::*)()>>
void* start_routine(void* ptr)
Expand All @@ -54,6 +55,7 @@ class NativeThread {
pthread_attr_t attr_storage, *attr = &attr_storage;
pthread_attr_init(attr);
pthread_attr_setstacksize(attr, TH_STACK_SIZE);
std::cout << "Stack Size: " << TH_STACK_SIZE << "\n";
pthread_create(&thread, attr, start_routine<T>, new P(obj, fun));
}
void join() { pthread_join(thread, NULL); }
Expand Down

0 comments on commit 2e1bc18

Please sign in to comment.