Re: Extending LuaJIT's memory limit to 4Gbytes.

  • From: Dmitri Shubin <sbn@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 21 Aug 2012 11:55:46 +0400

Hi Robert!

On 20.08.2012 11:36, Robert G. Jakabosky wrote:
As an experiment I created a mmap wrapper [1] library to get around the 1Gbyte
memory limit when running LuaJIT on Linux (this might work on other Non-
windows systems).

The wrapper library takes over management of as much of the lower 4Gbytes of
address space in the process as it can.  To do this it blocks the system's
malloc from using sbrk/brk to expand the programs data segment and uses a
custom page allocator to manage which pages of the lower 4Gbytes are free.
Just FYI.

To support LuaJIT on Solaris 64-bit I had to do the similar thing -- use custom page allocator for low 2GiB of address space. (mmap() on Solaris doesn't have MAP_32BIT flag and doesn't honor address hint) I "shift" executable as high as possible (by setting base address to 2GiB - 256MiB), "reserve" this space using MAP_NORESERVE and used vmem resource allocator from umem library [1][2] to allocate pages from it.
But I modified LuaJIT code instead of LD_PRELOAD'ing.


Other related posts: