Re: ffi.new intermittent failures

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

On Thu, Nov 14, 2013 at 2:30 PM, Lesley De Cruz <lesley.decruz@xxxxxxxxx> wrote:
> On 14 November 2013 11:23, Alexander Gladysh <agladysh@xxxxxxxxx> wrote:
>> On Thu, Nov 14, 2013 at 12:29 PM, Alexander Gladysh <agladysh@xxxxxxxxx> 
>> wrote:
>>> 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.
>>
>> In fact, the failures are _not_ intermittent. I guess, first
>> allocation is freed by GC when second fails:
> [...]
>
> ffi.new is also subject to the current 2GB limit (as the objects
> created by it are also GC'ed, I suppose?).
> See: 
> //www.freelists.org/post/luajit/Any-plans-to-increase-the-GC-upper-limit-of-LuaJIT-on-Linux-x86-64,3
> "If you allocate these with malloc() and not ffi.new(), they get
> access to the full x64 address range."
>
> Also, to avoid confusion, the "LuaJIT 2.1" referred to in that post is
> now LuaJIT 3.0.

Thank you for the reference!

Mike, is this ffi.new limit documented somewhere on the Wiki? (I also
did not find "official" documentation for the memory limits — but I
probably did lot look for them well enough.)

Best,
Alexander.

Other related posts: