I've committed some changes to SVN trunk that should deal with the problems you found. Typical ML programs allocate large numbers of small cells and the code didn't deal properly with a 10 million element array.
I don't know how much this was real code and how much you cut down for the example. It's generally better to avoid using too much mutable data such as arrays or refs if that's possible.
Regards, David