mmap() returned memory outside 2Gb - GHC on ubuntu hardy amd64

Simon Marlow marlowsd at
Thu Nov 20 03:58:57 EST 2008

Rahul Kapoor wrote:
>> I've made a speculative fix.  If you're able to test it, that would be very
>> helpful:
>> Cheers,
>>        Simon
> I had no luck installing the binary snapshot (libedit problems, which I worked
> around by creating a link to the version I had) after which I started get libc
> version problems so I gave up on that built the HEAD snapshot from source.
> running ghci in-place now gives:
> GHCi, version 6.11.20081117:  :? for help
> Loading package ghc-prim ... linking ... done.
> ghc: internal error: loadObj: failed to mmap() memory below 2Gb; asked
> for 57344 bytes at 0x0x4009fa00, got 0x0x7f3a9b2b8000.  Try specifying
> an address with +RTS -xm<addr> -RTS
>     (GHC version 6.11.20081117 for x86_64_unknown_linux)
> I am not really sure what I <addr> for -xm should be.

Ok, so we got a bit further, but it looks like at some point mmap() stopped 
giving us memory where we wanted it, perhaps because something else was 
already mapped at that address.

It would be useful to get a look at the memory map.  Can you load up GHCi 
in gdb, as follows.  First, find out the path to your GHC binary and the -B 
option it needs:

$ cat `which ghc`

exec /home/simonmar/fp/lib/x86_64-unknown-linux/ghc-6.10.1/ghc 
-B/home/simonmar/fp/lib/x86_64-unknown-linux/ghc-6.10.1/. -dynload wrapped 

Here, /home/simonmar/fp/lib/x86_64-unknown-linux/ghc-6.10.1/ghc is my GHC 
binary, and -B/home/simonmar/fp/lib/x86_64-unknown-linux/ghc-6.10.1/. is 
the option I need to pass.  Now start gdb:

$ gdb /home/simonmar/fp/lib/x86_64-unknown-linux/ghc-6.10.1/ghc

and run GHC:

(gdb) run --interactive 

It will now crash with the error you saw above.  At this point we need to 
look at the memory map.  Find the PID of the GHC process, by running 'ps 
uxw' in a terminal (don't quit gdb).  Then

$ cat /proc/<pid>/maps

where <pid> is the PID of the GHC process running in gdb, and send me the 


More information about the Glasgow-haskell-users mailing list