> Issue #5097 has been updated by Eric Wong.
>
> File 0001-allocate-th-altstack-early-run-GC-on-allocation-fail.patch added
>
> Jeremy: does my patch to allocate th->altstack in a place where xmalloc() is
> possible help?
>
> Since altstack is always initialized if Ruby is compiled to use it, I see
> no reason to delay the allocation.

Looks nice. I've commited it.
However, I dropped following hunk.

#if defined(MINSIGSTKSZ) && (ALT_STACK_SIZE < MINSIGSTKSZ)
#undef ALT_STACK_SIZE
#define ALT_STACK_SIZE MINSIGSTKSZ
#endif


Because it's only works if 1) SIGSTKSZ*2 < MINSIGSTKSZ or 2) SIGSTKSZ is
no defined, but MINSIGSTKSZ is defined. I haven't seen such platforms.

Frankly, current altstack size (i.e. SIGSTKSZ*2) is quite too large.
It was introduced
following commit. But, in fact, sigaltstack raise an error if an
argument is less than
MINSIGSTKSZ, not SIGSTKSZ. So, current one is overkill large.

I'd like to commit altstack reducing patch to trunk (of course, not
193) and wait a feedback.


commit 7c9a77f88031afaba8338cf7188bfa7391f8a06a
Author: yugui <yugui / b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date:   Sun Nov 23 04:17:52 2008 +0000

    * signal.c (ALT_STACK_SIZE): 4KB is not enough on Mac OS X.
      Uses SIGSTKSZ.  this fixes [ruby-core:20040].

    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20331 b2dd03c8-39d4-4d8f-9
---
 ChangeLog |    5 +++++
 signal.c  |    4 ++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/signal.c b/signal.c
index 38dd55f..0c98237 100644
--- a/signal.c
+++ b/signal.c
@@ -416,7 +416,11 @@ typedef RETSIGTYPE (*sighandler_t)(int);

 #ifdef POSIX_SIGNAL
 #ifdef USE_SIGALTSTACK
+#ifdef SIGSTKSZ
+#define ALT_STACK_SIZE SIGSTKSZ
+#else
 #define ALT_STACK_SIZE (4*1024)
+#endif