Could you help me

Stephen Weeks sweeks@intertrust.com
Tue, 5 Sep 2000 13:31:05 -0700 (PDT)


> To recompile the system:
> 
> lampiao:/usr/src/mlton-20000712/src# make
> Compiling mlton.c (takes a while)
> time gcc -I../include -O1                                       \
>         -DNODEBUG                                               \
>         -fomit-frame-pointer -fno-strength-reduce -w -m486      \
>         -malign-loops=2 -malign-jumps=2 -malign-functions=2     \
>         -c mlton.c
> cpp: Memory exhausted.
> Command exited with non-zero status 1
> 5.07user 0.30system 0:08.27elapsed 64%CPU (0avgtext+0avgdata
> 0maxresident)k
> 0inputs+0outputs (3144major+5784minor)pagefaults 0swaps
> make: *** [mlton.o] Error 1
> lampiao:/usr/src/mlton-20000712/src#

How much memory was available on your machine?  With 64M available, gcc should
be able to compile the C file.

> When I use the binary, I receive following message:

Is this the binary from the rpm, or were you finally able to recompile?

> lampiao:/usr/doc/mlton-20000712/examples# mlton hello-world.sml
> mmap failed
> lampiao:/usr/doc/mlton-20000712/examples#

Again, this is due to a memory problem.  The runtime system was unable to
allocate memory.  One thing to try is to limit the amount of memory used by
MLton.  You can do this by editing the bin/mlton script, changing line 38 to the 
following:

	exec "$mlton" '@MLton' 'load-world' "$world" max-heap 32m '--' $args

The max-heap 32m tells MLton not to use more than 32 megabytes for its heap.
You can put any number you like there (8m should be sufficient for hello-world).
Of course, MLton may run out of memory when compiling larger programs, but in
that case, it should print the message "Out of memory.", not "mmap failed".
This leads me to believe the problem is due to some other strangeness with
mmap.  We had seen a problem before with mmap not being able to allocate in the
entire 4 gig address space and us having to explicitly tell it where to
allocate.

To get even more runtime system information, you can change line 38 to the
following:

	exec "$mlton" '@MLton' 'load-world' "$world" max-heap 32m gc-messages gc-summary '--' $args