[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT on win32
- From: Mike Pall <mikelu-0603@...>
- Date: Fri, 17 Mar 2006 19:56:32 +0100
Hi,
Adam D. Moss wrote:
> One thought: before panicking with an OOM when presumably
> trying to create a fibre, could LuaJIT do a big aggressive
> GC to try to collect any abandoned coroutines?
The GC is already driven forward before every thread allocation.
Maybe this isn't enough for your case. Doing a complete GC is
probably considered 'unfriendly' (and the OOM may hit you
elsewhere).
> If the
> problem here is throwaway iterators jamming up the reserved
> address space (this seems reasonably likely since these are
> all I use coroutines for in the problematic app) then this
> may save the day. Dunno if this is easy or worth the bother.
Well then CreateFiberEx (XP or later only) wouldn't help.
I'm tempted to add lazy allocation/deallocation for the C stacks.
The C stack can be deallocated once a thread returns with
L->status != LUA_YIELD (either an error or 0 for completion).
There's no need to wait until the GC deletes the thread object
itself.
Only problem is that coroutine recycling (currently only possible
via the C API, not from Lua) may be slower. Or I could put the
stacks into a deferred free queue. Well ... I have to think about
this a bit more.
Bye,
Mike