On 27/01/2012 20:15, Phil Clayton wrote:
Thinking about explicitly deleting callbacks led me to ask whether each
ML function passed as a callback has its callback reused on subsequent
calls. If reuse occurs, the number of call sites in the source code
would bound memory usage.

I'm guessing that these callback objects are actually wrappers to invoke
compiled ML code and that there is only one instance of the compiled ML,
so there would be no problem having only one instance of the callback
object.

It would be nice if they could be reused but currently they aren't. I had a look at the code and did some experiments but the problem is that there is quite a lot of ML wrapping going on. That means that the RTS can't detect that the same function has been passed a second time. After the wrapping has been applied the closure that gets passed into the RTS is always different even if the same ML function was used further up.

I sometimes think the whole FFI system should be redesigned to remove some of the layers.

David

_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to