[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Portability of Lua
- From: William Ahern <william@...>
- Date: Tue, 30 Apr 2013 19:48:53 -0700
On Tue, Apr 30, 2013 at 09:56:26PM -0400, Rena wrote:
> On Tue, Apr 30, 2013 at 9:51 PM, Tim Hill <drtimhill@gmail.com> wrote:
>
> >
> > But the point is that the C "standard" leaves some things so open that
> > it's very difficult to write code without making some guesses. Width of an
> > integer? Behavior of C runtime functions? All have very subtle hidden
> > assumptions. For example, when you call "malloc()" you assume that it won't
> > take 5 seconds to allocate memory, but the standard is silent on such
> > issues as API overhead. Writing in standard C is a REQUIREMENT for
> > portability, but not a GUARANTEE.
> >
>
> Would such a guarantee even be possible? Even the fastest systems might
> take a while to allocate memory if there's none left, they're busy paging
> things out already, etc. An idea I've had in the past was that if an
> allocation ever fails, the process could be paused until enough memory is
> available instead of letting it die; in that case malloc() might block for
> any amount of time.
>
I believe that could easily result in a deadlock scenario.