Quick comments.

* JVM can specify per-thread stack size but always in bytes. Any API that
exposes stack size should be abstract rather than require a knowledge of
stack frame sizes from impl to impl. The "stack size factor" version is
pretty good.

* I agree it would be nice to specify per-thread stack sizes too. We must
do this for JRuby on Android, and have to use JRuby- specific mechanisms
for it.

-  Charlie (mobile)

On Oct 30, 2011 11:21 AM, "SASADA Koichi" <ko1 / atdot.net> wrote:
>
> Hi,
>
> I agree with this proposal.  Also add same parameter setting feature for
> Thread.
>
> However, I can't make good API to specify stack (VM and machine) size
> (and other parameters if there are).
>
> There are several proposals.
>
> Type 1: Thread creating argument (ex: Thread.new(stack_size: 1024))
> Type 2: Thread global parameter (ex: Thread.stack_size = 1024)
>
> I think Type 2 is not good (to set default value is okay.  However it
> conflicts other usage.  Typically thread-unsafe).
>
> I also think Type 1 has also problem.  If you want to pass keyword
> argument "stack_size" to fiber or thread, it should be conflict.
>
> My idea is creating new Thread (Fiber) class with new parameter:
>
>  MyThread = Thread.new_template(stack_size: 1024)
>  MyThread.new{
>    ...
>  }
>
> # Of course "new_template" is bad name.
>
> Any ideas?
>
>
> (2011/10/12 21:42), Robert Pankowecki wrote:
> >
> > Issue #3187 has been updated by Robert Pankowecki.
> >
> >
> > I would also welcome such improvement.
> > ----------------------------------------
> > Feature #3187: Allow dynamic Fiber stack size
> > http://redmine.ruby-lang.org/issues/3187
> >
> > Author: Mike Perham
> > Status: Open
> > Priority: Normal
> > Assignee:
> > Category:
> > 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
> >
> >
> >
>
>
> --
> // SASADA Koichi at atdot dot net
>