# mmap_lowmem **Repository Path**: CX-MAN/mmap_lowmem ## Basic Information - **Project Name**: mmap_lowmem - **Description**: mmap() wrapper to expand MAP_32BIT to use all of the low 4Gbytes of address space. - **Primary Language**: C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-04-01 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README About ===== This is a wrapper for mmap() to expand the address range of the `MAP_32BIT` flag from 31bits to a full 32bits (i.e. the low 4Gbytes). This allows access the almost a full 4Gbytes of 32bit addresses. The main use of this wrapper is to allow LuaJIT to use more then 1Gbyte of ram on Linux. With this wrapper LuaJIT can use amost a full 4Gbytes of ram. Compile ======= $ make Usage ===== Dynamically during run-time None thread-safe version: $ LD_PRELOAD="./libmmap_lowmem.so" luajit-2 Or link luajit-2 with `libmmap_lowmem.so` Thread-safe version: $ LD_PRELOAD="./libmmap_lowmem_mt.so" luajit-2 Or link luajit-2 with `libmmap_lowmem_mt.so` Getting every last bit of the low 4Gbytes available =================================================== Compiling the LuaJIT executable as a [position-independent executable](http://en.wikipedia.org/wiki/Position-independent_code) will move the program brk (used by malloc) to an address outside the low 4Gbytes. Use this make command to build LuaJIT: $ make all LDFLAGS=" -pie " CFLAGS=" -fPIC " TODO ==== * Handle `MREMAP_MAYMOVE` & `MREMAP_FIXED` flags for mremap wrapper. * Valgrind support. * Cleanup code.