Issue #3187 has been updated by Tomoyuki Chikanaga.

File fiber_stacksize.patch added
Category set to core

Hi,

I've written a patch. This patch adds some methods Fiber.default_vm_stacksize, Fiber.default_vm_stacksize=, Fiber#vm_stacksize and add an optional Hash argument to Fiber#initialize, and tests for them.
You can specify default VM stack size of Fiber created afterward and/or specify individually when create a Fiber.

ex)
  Fiber.default_vm_stacksize = 16 * 1024
  
  Fiber.new do
    do_something
  end

or

  Fiber.new(:vm_stacksize => 16 * 1024) do
    do_simething
  end

Note that the size of VM stack is number of Objects and memsize of stack is vm_stacksize * sizeof(VALUE) bytes.
Also note that this patch enable to change only VM stack size, but not machine stack size. I think when Fiber is implemented based on makecontext/swapcontext (FIBER_USE_NATIVE=1), machine stack size (default: 64KB) can be configurable. I wonder if procedures like `parse_some_big_xml' in Mike's example also need larger machine stack size? Does anyone have such a testcase?
----------------------------------------
Feature #3187: Allow dynamic Fiber stack size
http://redmine.ruby-lang.org/issues/3187

Author: Mike Perham
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 1.9.x


=begin
 I'd like a way to increase the size of the Fiber stack dynamically so when my program starts, I can set it to whatever value I need for the code I'm running.  4KB is too easy to run into problems when running recursive code but settling on any arbitrary static value seems pointless to me.
=end



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