Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this questionSomeone please see my code at this link for input taken from 2.2 mb file.
This produces seg fault. By gdb, it shows seg fault in _vfprintf_r()
. But when I comment line 41 and uncomment 38 (a null statement), there is no segmentation fault. line no 41 is just print statement.
The output is written into result.txt
file.
You have a stack overflow. That's right, a Stack Overflow. I was able to reproduce by doing ulimit -s 1024. You need to not recurse so deeply, or you need to increase your stack size.
As Matt answered, you're running out of stack. Add /STACK:amount to reserve in bytes,amount to initially commit in bytes to your link.exe command line.
Make sure both numbers are multiples of 4096, which is the default page size on windows IIRC.
精彩评论