[MLton] Is it safe to use an alternative malloc with Mlton programs?

Ville Tuulos tuulos at gmail.com
Mon Jan 19 17:39:06 PST 2009


Hi

I'm working on a small internal project which uses MLton. We have some
extensions written in C which use Judy arrays
(http://judy.sourceforge.net/). After handling large amounts of data
with Judy, the process' memory space gets really fragmented which
slows down any subsequent malloc() calls (this is not MLton-related
per se).

It seems that TCMalloc by Google
(http://goog-perftools.sourceforge.net/doc/tcmalloc.html) handles
small allocations, which Judy does all the time, much better than the
glibc's standard malloc.

Based on quick grepping of MLton's sources, it appears that malloc()
is not used in many places - I assume that internal memory handling is
done by mmap().

If this is the case, is it safe to link MLton / C code against TCMalloc?


Ville Tuulos
Nokia Research
Palo Alto



More information about the MLton mailing list