Application exception unknown software exception (0XC00000FD) ...-Stack overflow (stack overflow)

Source: Internet
Author: User

Today, when you write a program, pop-up dialog boxes are displayed:

The application has an exception unknown software exception (0XC00000FD):

This is how the code reads a CSV file in a function, initializes a variable directly based on the size of the CSV file, and then reads and assigns the entire file to the variable at once.

At the beginning of the test is usually a small file of hundreds of K, there is no problem. When I choose a more than 1M picture, the above problem arises.

At first, from the error prompt, there is no hint that: stack overflow (stack overflow)

After setting a breakpoint in the code, find the key code: char Csv_content_ucs[filesize];

When the file is large, you need to open a large stack of space, beyond the system limits, will pop up the above error.

The solution is also simple: make and heap to store the data on the line malloc (fileSize)

Some online information about stack overflow (stack overflow):

Source: http://blog.csdn.net/zhongjling/article/details/8073796

Explain:

Generally, the stack space for each process is limited. (Why limit?) To learn the assembly and the operating system will know)

Generally 1M or 2M.

What occupies the stack space?

In addition to the system stack occupancy, basically is the stack variable. (What is a stack variable?) No language ¥%*&......%¥%&)

In short, the above is a stack variable.

There are two ways to modify:

Change to a heap variable:

int* pa = malloc (sizeof (int) *1000*1000);

The PA can then be used as an array. (Arrays and pointers are basically equivalent in C.)

Of course, no need to remember the free PA.

Two modification system limits

This stack variable = 1000*1000*4 = 4M. (approximately equals)

If this function is not frequently called and is not recursive, it will generally be acceptable.

You can modify the operating system size limit on the process stack space, slightly larger.

Ulimit View the limitations of the system. (*nix system command.) Not Windows)

Of course, method Two is not worth recommending

2014-06-26

Application exception unknown software exception (0XC00000FD) ...-Stack overflow (stack overflow)

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.