Re: ffi.new intermittent failures

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

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:

$ luajit2
LuaJIT 2.0.2 -- Copyright (C) 2005-2013 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 ATOM fold cse dce fwd dse narrow loop abc sink fuse
> ffi = require 'ffi'
> a = ffi.typeof('char[1000000000]')()
> b = ffi.typeof('char[1000000000]')()
not enough memory
> c = ffi.typeof('char[1000000000]')()
not enough memory
> d = ffi.typeof('char[1000000000]')()
not enough memory
> e = ffi.typeof('char[1000000000]')()
not enough memory
>

Alexander.

Other related posts: