My default stack size (according to ulimit -s) is 8192 kB, so naturally the code below segfaults when I try to run it. Also, naturally, it works fine if I do a 'ulimit -s 9000'.
However, when I do a 'ulimit -s unlimited' the code segfaults again. Any ideas what is going on here?
If it's useful, I'm running Debian 10 with kernel 4.19.0-6 and gcc version Debian 8.3.0-6.
#include
#include
#include
void* wait_exit(void*)
{
char bob[8193*1024];
return 0;
}
int main()
{
pthread_t t_exit;
int ret;
if((ret = pthread_create(&t_exit,NULL,wait_exit,NULL)) !=0)
{
std::cout<<"Cannot create exit thread: "<
Asked by user3856370
(247 rep)
Nov 20, 2020, 05:34 PM
Last activity: Nov 20, 2020, 05:48 PM
Last activity: Nov 20, 2020, 05:48 PM