Issue #2126 has been updated by Suraj Kurapati.


Sigh, yet another mistake.  Below is my corrected request.  Sorry for
the trouble.

  Add a max_stack_size parameter to ruby_init_stack():

     void ruby_init_stack(VALUE* stack_start, size_t max_stack_size);

  Add a function to return Ruby's preferred stack size:

     size_t ruby_stack_size_preference();

  Add a function to return Ruby's preferred stack direction:

     bool ruby_stack_descends_p(); /* stack grows from high to low? */

  This way, I can provide a custom stack to Ruby:

     size_t stack_size = ruby_stack_size_preference();
     bool stack_descends = ruby_stack_descends_p();

     VALUE* stack_start = malloc(stack_size);

     if (stack_descends) {
       stack_start += stack_size;
     }

     ruby_init_stack(stack_start, stack_size);

If you wish to minimize the number of new functions added to the Ruby
C API, then perhaps you could add a RUBY_INIT_STACK_ON_HEAP macro
which makes Ruby do (internally) everything in the code shown above.

Thanks for your consideration.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2126

----------------------------------------
http://redmine.ruby-lang.org