Setting the stack size
Mike Parker
aldacron at gmail.com
Thu Dec 2 06:36:41 PST 2010
On 12/2/2010 10:33 AM, Andrew Wiley wrote:
> On Wed, Dec 1, 2010 at 7:14 PM, Mike Parker <aldacron at gmail.com
> <mailto:aldacron at gmail.com>> wrote:
>
> On 12/2/2010 6:12 AM, Andrew Wiley wrote:
>
>
>
> On Wed, Dec 1, 2010 at 2:36 PM, bearophile
> <bearophileHUGS at lycos.com <mailto:bearophileHUGS at lycos.com>
> <mailto:bearophileHUGS at lycos.com
> <mailto:bearophileHUGS at lycos.com>>> wrote:
>
> Franciszek Czekala:
>
> > How do you set the stack size for D programs?
>
> On Windows with DMD this is how to set the max stack size to
> about
> 1.5 GB of the "test.d" module:
> dmd -L/STACK:1500000000 test.d
>
> (I'd like D to have a standard syntax (maybe a pragma(...))
> to tell
> the other parts of the compilation chain how much stack to use).
>
>
> If the stack size is only set by the executable on Windows, I
> don't see
> how that would be useful.
>
>
> It's not set by DMD, but by the linker. You need to pass the
> appropriate flag to the linker on each platform via the -L command
> line option. bearophile's example is for OPTLINK. On platforms where
> DMD is backed by the gcc toolchain, you should be able to use
>
> dmd -L--stack 1500000000 test.d
>
>
> $ ld --stack
> ld: unrecognized option '--stack'
> ld: use the --help option for usage information
>
> The linker doesn't set the stack size on Linux/Unix (seems like OSX is
> an exception). You set the stack size in the environment with 'ulimit -s'
I got that from the ld man page [1]. But on checking again, I see this:
[This option is specific to the i386 PE targeted port of the linker]
Sorry about that.
[1] http://linux.die.net/man/1/ld
More information about the Digitalmars-d
mailing list