[MLton] Memory problems with latest CVS?

Henry Cejtin henry@sourcelight.com
Fri, 10 Sep 2004 11:56:57 -0500


You can tell gmp to blow up if realloc (or malloc) is called.  The function to
use is mp_set_memory_functions().  There are two problems though:
One is that you don't want to force a dependency on libgmp.so unless InfInf
is actually used, and I don't know how to avoid that.
The second is that the gmp gcd() code (even the lowest level) will call these
allocation and freeing routines.  This is also bad because it doesn't respect
things like MLton setting the maximum heap size.
Still, an improvement would be to test in an assert that the mpz routines
return the original space, except for gcd.