Geoff Leyland wrote: > So far, asking mmap for memory at 4GB seems to give the next > free space above 4GB, which is nice, but the docs suggest that's > luck rather than subject to a guarantee. Actually, since you're on OSX, the built-in LuaJIT allocator for OSX/x64 depends on mmap() doing a linear search starting at the given address (to allocate 32 bit memory). So you might as well use it to always allocate memory above 4GB. Which in turn explains why malloc() goes for the low 4GB when pagezero is shrunk: mmap() with a NULL address starts looking for free space at address zero. Duh. [Linux mmap() starts searching at (random) higher addresses if given NULL. That would solve your problem. Unfortunately, it does that too when the requested address is not free -- a simple probing approach to get 32 bit memory wouldn't work there. Ok, so let's parse /proc/self/maps and handle race conditions ... Yay.] --Mike