开发者

Strange segmentation fault C++ in _vfprintf_r() [closed]

开发者 https://www.devze.com 2022-12-10 11:51 出处:网络
Closed. This question needs debugging details. It is not currently accepting answers. 开发者_开发百科
Closed. This question needs debugging details. It is not currently accepting answers. 开发者_开发百科

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 question

Someone 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消