Setting the stack size

Andrew Wiley debio264 at gmail.com
Wed Dec 1 17:33:19 PST 2010


On Wed, Dec 1, 2010 at 7:14 PM, Mike Parker <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>> 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'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101201/8c9b0acd/attachment.html>


More information about the Digitalmars-d mailing list