[MLton-user] Slow GCC

Tom 7 twm at andrew.cmu.edu
Thu Jan 18 06:41:41 PST 2007

I've had this same problem on cygwin for a long time. I always use the 
@MLton max-heap 200m -- argument to mlton in order to bound the amount of 
memory that mlton uses, otherwise it completely hoses my 512mb machine 
even compiling the empty program. We also had a similar problem with our 
mlton-compiled cygwin version of Concert. Maybe on cygwin it's better to 
use the Windows-specific spawn function to invoke gcc like I assume the 
mingw port does? That one runs fine without any special options.

  - Tom

>>>> More information: if I do a mlton -stop g and then a mlton on the .c
>>>> and .S files, it takes no time at all to do the gcc part, but if I run
>>>> the whole thing as one big mlton job, gcc swaps like mad.
> Neal mentioned that, from what he can see, after spawning gcc, both the 
> original mlton process and the gcc process are holding onto approximately 
> 400M of memory.  It seems like the virtual memory isn't given up by the 
> forked process when it execs gcc (which I think is the semantics of mmap 
> under Posix).  Even if the memory is copy-on-write, its taking a chunk out of 
> the virtual memory that gcc sees.

More information about the MLton-user mailing list