Re: Calling fopen() from a simple C++ program in Xcode 5.0.2 raises EXC_BAD_ACCESS, code=2
Re: Calling fopen() from a simple C++ program in Xcode 5.0.2 raises EXC_BAD_ACCESS, code=2
- Subject: Re: Calling fopen() from a simple C++ program in Xcode 5.0.2 raises EXC_BAD_ACCESS, code=2
- From: Sean McBride <email@hidden>
- Date: Fri, 03 Jan 2014 14:31:40 -0500
- Organization: Rogue Research Inc.
On Mon, 23 Dec 2013 23:45:57 -0600, Ken Thomases said:
>> const size_t inBufferSize = 10000000; // about 10 MB
>
>> char buffer[inBufferSize];
>
>The default stack size is 8MB. Your "buffer" variable exceeds that. I
>suspect that's the problem. Don't put such large buffers on the stack.
>Allocate them on the heap.
gcc can warn about that:
g++ -fsyntax-only -Wlarger-than=2000 test.cxx
test.cxx:6:26: warning: size of ‘buffer’ is 10000000 bytes [-Wlarger-than=]
char buffer[inBufferSize];
^
Alas, clang doesn't support -Wlarger-than:
<http://llvm.org/bugs/show_bug.cgi?id=10623>
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden