Carlos Delgado Carlos Delgado - 4 months ago 22
C Question

Redis on AIX memory allocation

I have compiled Redis 3.0.6 to in an AIX 6.1 ppc systems using gcc, but it crashes when the database tries to exceed 2GB of RAM.

The compiler flags and environment variables are:

alias make="gmake"

export CC=gcc
export CFLAGS="-DAIX64 -DBIT64 -maix64 -D_AIX -D_AIX53 -D_AIX61 -I/opt/freeware/include -I/usr/include${CFLAGS_XTRA}"
export CXX=g++
export CXXFLAGS=$CFLAGS
export LDFLAGS="-DAIX64 -DBIT64 -maix64 -L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib/pthread/ppc64:/opt/freeware/lib:/usr/lib:/lib,-bmaxdata:0x80000000"

export AR="ar -X64"
export LIBPATH=.:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib
export OBJECT_MODE=64
echo Gcc environment variables \(CC,CFLAGS,LDFLAGS,LIBPATH,etc\) are set.


But when it reaches 2GB of RAM it crashes with the following log:

41680910:M 12 Jan 12:46:13.056 # Out Of Memory allocating 102709 bytes!
41680910:M 12 Jan 12:46:13.056 # === REDIS BUG REPORT START: Cut & paste starting from here ===
41680910:M 12 Jan 12:46:13.056 # ------------------------------------------------
41680910:M 12 Jan 12:46:13.056 # !!! Software Failure. Press left mouse button to continue
41680910:M 12 Jan 12:46:13.057 # Guru Meditation: "Redis aborting for OUT OF MEMORY" #redis.c:3572
41680910:M 12 Jan 12:46:13.057 # ------------------------------------------------


It also crashes in I try to execute

redis-server --test-memory 2048


But not if I execute

redis-server --test-memory 2047


So clearly it has to be with a 2GB limit that I can't find.

Any ideas or further information required?

Answer Source

Try omitting -bmaxdata:0x80000000. On 64-bit builds, this parameter limits the heap size to 2GB. On 32-bit builds, it will increase the low default to 2GB.