Hi,

At Wed, 21 Oct 2009 00:45:15 +0900,
_ wanabe wrote in [ruby-core:26184]:
> It's probably because the following situation.

Seems reasonable.

> 1. fiber_init() (== Fiber#initialize) raises NoMemoryError.
> 2. next_fiber == NULL || next_fiber == NULL || local_storage == NULL ||
>    saved_thread.stack is not allocated, but keeps original th->stack.
> 3. fiber_free() cause SEGV.

In another case, when st_init_numtable() to initialize
local_storage fails, it might be left pointing the current
thread's local_storage, and cause double-free.  So I suspect
fib->saved_thread.local_storage should be cleared after
cont_init() in fiber_t_alloc().

Also, setting prev_fiber and next_fiber in root_fiber_alloc()
will be no longer needed.

-- 
Nobu Nakada