Large array failure

I have a Swift project with some C code in it. The C code creates a byte array with about 600K elements. Compiling under Xcode, the compilation takes a really long time. When I try to run the code, it fails immediately upon startup. When I cut this large array out of the build, everything else works fine. Does anyone know what's going on here, and what I might do about it?

Answered by JWWalker in 786520022

Is the array allocated on the heap (e.g., with malloc) or on the stack? In the latter case, you may be exceeding the available size of the stack.

Accepted Answer

Is the array allocated on the heap (e.g., with malloc) or on the stack? In the latter case, you may be exceeding the available size of the stack.

Large array failure
 
 
Q