linux - Memory allocation by threads in c -
how reduce memory used threads in c? although thread takes 8 10 mb of memory, there way reduce memory?
yes can set size of thread stack.
pthread_attr_t attribute; pthread_t thread; pthread_attr_init(&attribute); pthread_attr_setstacksize(&attribute,size); // size may defined u 1024,2048,etc pthread_create(&thread,&attribute,fun,0);
................................................
void *fun(void *arg) { .... }