lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Sep 12, 2014 at 07:42:29PM -0400, Sean Conner wrote:
<snip examples>
>   To me, that says trying to handle out-of-memory conditions from within Lua
> is dicey at best.  Interesting.

I agree. It's especially difficult to deal with in something like Lua
because of all the tiny allocations that can occur for even simple
operations. And you can't easily isolate the issue to a particular sub-task
like you can with languages where you do explicit memory management, because
you can't easily arrange for atomic (wrt to resource acquistion) changes to
application state.

So in pure Lua applications it's not something I spend any time trying to
solve. My libraries deal with ENOMEM, and I pass through the error like any
other when I bind those libraries using a Lua module. I do this beause it's
good code hygiene, IMO. But typically I expect the process to abort, and
that's part of the QoS profile when I'm selecting an implementation (e.g.
all C, C + embedded Lua, Lua + embedded C, etc).

Again, context matters. But this is a typical cost+benefit trade-off for
automated garbage collection environments.