Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
ocamlc.opt tries to allocate 34 GB of RAM ... and fails
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-05-08 (10:14)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] ocamlc.opt tries to allocate 34 GB of RAM ... and fails

OK I've found out where it's going wrong and I have a theory, ill-informed
probably, about the problem.

Firstly when I run the compiler with OCAMLRUNPARAM=v=0x1ff, just
before the error I see:

  Growing heap to 4320k bytes
  Growing page table to 34359705221 entries
  No room for growing page table
  Fatal error: out of memory.

and running it under gdb seems to indicate that the problem is a
massive malloc() request, the second call to malloc in the function

Now my uninformed theory: The preceeding mmap (from caml_aligned_mmap)
returned a very high memory address:

  mmap(0x722020, 495648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffff7f83000

and the runtime is trying to construct a page table (bitmap, right?)
to track both very low and very high addresses.  That's failing,

Does this sound right?

Unfortunately I have no idea how to solve this, certainly it seems
there is no simple fix ...  (I tried to set vm.overcommit_memory
policy, but that doesn't work because the page table is initialized
right after allocation).


Richard Jones
Red Hat