David,

Thanks, that's good to know.

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.

Phil


On 27/01/12 19:11, David Matthews wrote:
Phil,
Currently, callbacks remain in effect for ever and are never
garbage-collected. I've certainly come across cases where I would want a
callback to remain in effect after the function that passed it in had
returned. For example, the window procedure in RegisterClassEx in
Windows. I don't know if there should be some way to delete a callback
explicitly.

Regards,
David

On 27/01/2012 17:47, Phil Clayton wrote:
I have been assuming that the pointer back to an ML function passed to a
foreign C function will still be valid after the C function has
returned, so the callback can occur sometime later (from a different C
function). Is that a valid assumption?

I made this assumption based on some tests in which one such callback
pointer remained valid for the life of the application. It would be nice
to know I wasn't just being (un)lucky!

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


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

Reply via email to