[MLton-user] gcc 4.1.1 crash "virtual memory exhausted: Cannot allocate memory" with mlton-20051202 on solaris

Matthew Fluet fluet at tti-c.org
Sun Jan 14 13:36:32 PST 2007


> I tried to use the MLton option -coalesce with different values (2048 and
> 1024) but it seems that it has no effect on the biggest files. Am I missing
> something.

No, you are not missing anything.  The -coalesce option instructs the 
compiler to combine multiple Machine IL functions into one 'chunk' to be 
emitted as a single C function.  However, the option has no effect on 
Machine IL functions whose size is already above the coalesce limit.

The two largest Machine IL functions (and, hence, the largest .c files) 
usually correspond to the initialization of global values and the other 
corresponds to the main control-flow path of the program.  On large 
input programs, both of these can be large.

> In my case, there is only one file which fails to build with -01. I could
> notice that when I use the -keep g option, the .c files are named
> sources.0.c, sources.1.c . sources.234.c and the file that fails to build is
> sources.234.c. I guess it is not a coincidence.

If it is the very last .c file, then it is probably the initialization 
of global values.  There isn't a general mechanism in place for 
splitting large Machine IL functions into smaller functions, though the 
compiler could be extended to do so.  In any case, the initialization of 
global values is only executed once, so compiling that file with -O0 
would have a negligible impact on performance, although it is cumbersome 
to compile the .c files outside of mlton.




More information about the MLton-user mailing list