Re: ffi.new intermittent failures

  • From: Alexander Gladysh <agladysh@xxxxxxxxx>
  • To: LuaJIT Mailing List <luajit@xxxxxxxxxxxxx>
  • Date: Thu, 14 Nov 2013 12:39:50 +0400

On Thu, Nov 14, 2013 at 12:35 PM, Justin Cormack
<justin@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> On 14 Nov 2013 08:30, "Alexander Gladysh" <agladysh@xxxxxxxxx> wrote:
>>
>> Hi, list!
>>
>> We observe intermittent failures in ff.new, when attempting to
>> allocate a largeish chunk of memory on Linux (see below). C calls like
>> calloc work fine.
>>
>> Any clues?
>
> Look at the allocation code. For x64 it uses mmap with hints and needs to
> get low 2G addresses which can fail. Best to call mmap yourself for huge
> allocations and allocate over 2G.

Erm. What is the reason behind this implementation? That's FFI
allocation, not one for internal Lua works.

Thanks!
Alexander.

Other related posts: