cstacksize

What is the stack size on Cygwin/Windows 64bit?


How to increase stack size and similar? I want to know the stack size on Cygwin 64 bit for windows. I'm programming with C on netbeans and i tried to make a stack overflow to find the answer. From the code I obtained 43104 as result... Now, what this number is? bit-Kb-Mb? Sorry for my english :)


Solution

  • Since you are using cygwin this is very easy with getrlimit

    #include <stdio.h>
    #include <sys/resource.h>
    #include <sys/time.h>
    
    int
    main(void)
    {
        struct rlimit rl;
    
        if (getrlimit(RLIMIT_STACK, &rl) != 0)
            return -1;
        fprintf(stdout, "current: %ld kB\n\n", rl.rlim_cur / 1024);
    
        return 0;
    }