[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: error() or nil, 'error msg'
- From: William Ahern <william@...>
- Date: Mon, 15 Sep 2014 17:20:59 -0700
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.
- References:
- error() or nil, 'error msg', Andrew Starks
- Re: error() or nil, 'error msg', Sean Conner
- Re: error() or nil, 'error msg', Andrew Starks
- Re: error() or nil, 'error msg', Sean Conner
- Re: error() or nil, 'error msg', William Ahern
- Re: error() or nil, 'error msg', Sean Conner
- Re: error() or nil, 'error msg', Sean Conner