Hi Robert! On 20.08.2012 11:36, Robert G. Jakabosky wrote:
As an experiment I created a mmap wrapper  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  to allocate pages from it.
But I modified LuaJIT code instead of LD_PRELOAD'ing. http://static.usenix.org/publications/library/proceedings/usenix01/full_papers/bonwick/bonwick_html/