This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Stack size on 64-bit Cygwin


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


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgp804bJdVaNp.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]