ghc 6.10.1 on freebsd 7 amd64 - ghci problems

Simon Marlow marlowsd at
Wed Dec 10 08:55:07 EST 2008

Markus Barenhoff wrote:
> On Fri 28.11 09:42, Simon Marlow wrote:
>> Markus Barenhoff wrote:
>>> On Thu 27.11 09:49, Simon Marlow wrote:
> Hi!
>>> I checked out and translated the head version of ghc today from darcs.
>>> It compiled fine. When I now try to start the ghci I get the following:
>>> ---- snip ----
>>> GHCi, version 6.11.20081126:  :? for help
>>> ghc: internal error: loadObj: failed to mmap() memory below 2Gb; asked for 
>>> 626688 bytes at 0x40000000, got 0x801635000.  Try specifying an address 
>>> with +RTS -xm<addr> -RTS
>>>    (GHC version 6.11.20081126 for x86_64_unknown_freebsd)
>>> 	    Please report this as a GHC bug:  
>>> 		Abort (core dumped)	
>>> ---- snip ----
>>> If it helps somehow, you can find the core dump here:
>> That's odd, because 6.8.3 is using 0x40000000 on FreeBSD and is working 
>> fine (or is it?).
> yes, it worked, but I haven't installed anymore - so I'am not sure, where it
> does maps its stuff into memory.

The memory map shows that there's nothing mapped in at the place we're 
asking for memory, but still FreeBSD decides to give us memory somewhere 
else.  I checked back in 6.8.3 and it looks like we were using MAP_FIXED - 
now MAP_FIXED is dangerous, because it will overwrite existing mappings 
(like the binary itself!), which is why we're not doing that now.

I've committed a patch that uses MAP_FIXED on FreeBSD if other attempts to 
get memory below 2Gb fail.  I'd be grateful if you could test it out, the 
patch is this one, pushed to HEAD today:

Wed Dec 10 11:57:51 GMT 2008  Simon Marlow <marlowsd at>
   * On FreeBSD, try MAP_FIXED if ordinary mmap() fails to give us suitable 
   This appears to be necessary on FreeBSD.  It might be necessary on
   other OSs too, but I'm being cautious because using MAP_FIXED can lead
   to crashes by overwriting existing mappings, and we have no (easy) way
   to prevent that.


More information about the Glasgow-haskell-users mailing list