Issue: #204 Allocate 8 MB to thread stack

Former-commit-id: 66a41dafc47a20251f5f6776625780dfa26ee505
This commit is contained in:
christianEQ 2020-11-30 21:56:20 +00:00 committed by John Sully
parent abd543c8e9
commit e6b4537a5d

View File

@ -5788,9 +5788,13 @@ int main(int argc, char **argv) {
setOOMScoreAdj(-1); setOOMScoreAdj(-1);
serverAssert(cserver.cthreads > 0 && cserver.cthreads <= MAX_EVENT_LOOPS); serverAssert(cserver.cthreads > 0 && cserver.cthreads <= MAX_EVENT_LOOPS);
pthread_t rgthread[MAX_EVENT_LOOPS]; pthread_t rgthread[MAX_EVENT_LOOPS];
pthread_attr_t tattr;
pthread_attr_init(&tattr);
pthread_attr_setstacksize(&tattr, 1 << 23); // 8 MB
for (int iel = 0; iel < cserver.cthreads; ++iel) for (int iel = 0; iel < cserver.cthreads; ++iel)
{ {
pthread_create(rgthread + iel, NULL, workerThreadMain, (void*)((int64_t)iel)); pthread_create(rgthread + iel, &tattr, workerThreadMain, (void*)((int64_t)iel));
if (cserver.fThreadAffinity) if (cserver.fThreadAffinity)
{ {
#ifdef __linux__ #ifdef __linux__