Array Size Limits

Danny Smith dannysmith@clear.net.nz
Tue Dec 14 09:07:00 GMT 2004


Nathan Sidwell wrote:
> The maximum stack size is controlled by the environment, not the
> compiler.  I know there is a way in Microsoft Windows for a program
> to say 'I need X bytes of stack', but I don't know exactly what that
way is.

On MS Windows, the address space  reserved for the stack  is set by
linker
and encoded into the PE header. The default with GNU ld.exe is 2MB
(the native MS linker defaults to 1MB)

To reserve, for example, 32MB of address space,
add -Wl,--stack,0x2000000

Be careful with reserving very large stack arenas in multi-threaded apps
on
windows, since each thread will default to the same value as the
primary thread unless told otherwise.

Danny

> nathan



More information about the Gcc-patches mailing list