Stack size on 64-bit Cygwin

Ken Brown kbrown@cornell.edu
Mon Aug 19 10:49:00 GMT 2013


On 8/19/2013 5:32 AM, Corinna Vinschen wrote:
> On Aug 16 16:49, Ken Brown wrote:
>> The problem that has been discussed at length in the thread "64-bit
>> emacs crashes a lot" appears to have been solved on the emacs-devel
>> list.  (I say "appears to" because I'm waiting for Ryan to confirm
>> this.)  The problem went away for me when I built emacs with
>> 'LDFLAGS=-Wl,--stack,4194304'.  I'm wondering if it's just that
>> emacs needs an unusually big stack or if the default stack size on
>> 64-bit Cygwin should be increased for all applications.
>>
>> I noticed that ulimit -s gives 2025 on both 32-bit Cygwin and 64-bit
>> Cygwin.  Shouldn't 64-bit applications need a larger stack than
>> 32-bit applications in general?
>
> Well, in fact 2 Megs is a pretty big stack to begin with.  If you check
> the Windows executables in C:\Windows\system32, you'll notice that a
> predominant number of them have their stacksize set to <= 1 Meg.  Also,
> if you don't set the default stack size explicitely when building
> applications with VC++, the default stacksize will be set to 1 Meg on
> both platforms, x86 and x64.
>
> So, by setting the default stacksize to 2 Megs, gcc is already leaning
> towards the safe side and it's *much* more than most applications really
> need.  From my POV, if you have a stack-active application, just add the
> aforementioned --stack linker option, or call peflags -x after the
> build.  The latter can be done any time, for instance:
>
>    tcsh$ peflags -x /bin/bash
>    /bin/bash: stack reserve size      : 2097152 (0x200000) bytes
>    tcsh$ bash -c 'ulimit -s'
>    2025
>    tcsh$ peflags -x0x400000 /bin/bash
>    /bin/bash: stack reserve size      : 4194304 (0x400000) bytes
>    tcsh$ bash -c 'ulimit -s'
>    4073

OK, thanks.  I'll just use the --stack option the next time I rebuild 
emacs.  But it's good to know that users can change this themselves with 
peflags.

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list