From 64270d3df28624de151b5d555e02b42b48c5b301 Mon Sep 17 00:00:00 2001 From: kosaki Date: Sat, 30 Jul 2011 01:58:21 +0000 Subject: merge revision(s) 32749: * vm.c (th_init): preallocate alternative stack. NoMemoryError is better than rb_bug, of course. Patch by Eric Wong. [ruby-core:38572][ruby-core:38594]. * signal.c (rb_register_sigaltstack): ditto. * vm_core.h: moved ALT_STACK_SIZE definition from signal.c. * vm.c (thread_free): use xfree() instead of free(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'vm.c') diff --git a/vm.c b/vm.c index d945fba0d7..3c1e8b4113 100644 --- a/vm.c +++ b/vm.c @@ -1754,7 +1754,7 @@ thread_free(void *ptr) else { #ifdef USE_SIGALTSTACK if (th->altstack) { - free(th->altstack); + xfree(th->altstack); } #endif ruby_xfree(ptr); @@ -1826,6 +1826,9 @@ th_init(rb_thread_t *th, VALUE self) th->self = self; /* allocate thread stack */ +#ifdef USE_SIGALTSTACK + th->altstack = xmalloc(ALT_STACK_SIZE); +#endif th->stack_size = RUBY_VM_THREAD_STACK_SIZE; th->stack = thread_recycle_stack(th->stack_size); -- cgit v1.2.3