Hello.
I found memory leak when FFI callback and ref value. I checked Poly/ML 5.8 and 5.7. Simple code for reproduce the memory leak is attached.
To prevent the memory leak I clean ref value (see comment in example). But It must do the garbage collector, is it? At least MLton have not this problem.
Result of run of example code:
Without clean ref value (The memory leak is) USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND nick 19855 91,8 9,7 305016 289452 6 S+ 16:53 0:17,94 poly --script cb-po
With clean ref value USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND nick 19862 65,3 0,6 32632 17476 6 S+ 16:54 0:10,77 poly --script cb-poly
Best, Nick.