About stack Overflow and manual open stack

Source: Internet
Author: User

Let's start with the question:

1. Why is there a stack overflow?

1. When recursive invocation, the depth of recursion will cause the system stack Overflow

2. When an array is defined directly in the function, the array space is too large, (the directly defined array in the function is the application space in the stack area, the stack space is limited
If it is defined outside the function, it is applied in the heap, so the large array needs to be defined outside the function)

2. How do I manually open the stack?

Microsoft's compilers (C + +)

#pragma COMMENT (linker, "/stack:102400000,102400000")

g++

    int size = << 20; 256MB    Char *p = (char*) malloc (size) + size;    __asm__ ("Movl%0,%%esp\n":: "R" (p));


About stack Overflow and manual open stack

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.