I don't actually need to "use" this cross-thread, but I'd like to free_memory when I'm done with it. This requires me to hold onto JITModule in my type so that I'm able to call free_memory in the Drop impl when everything is done. From what I can tell it shouldn't be a problem to make this type compatible with such a use-case.
A few fields such as libcall_names: Box<dyn Fn(ir::LibCall) -> String> are !Send, which is stopping this type from being used in this way, but it should be able to be easily added.
I'm also fine with a different way that allows me to free the memory, even if it doesn't involve holding onto JITModule. All I need is to free memory without being restricted to the same thread. I don't care that much how it's done as long as it works.
Any thoughts on this?
Huh, I thought I made JITModule Send a long time ago, guess not. IMO it makes sense to make JITModule implement Send.
Ahh! So that's what happened. I'm glad to hear this then! :blush:
bjorn3 said:
Huh, I thought I made JITModule
Senda long time ago, guess not. IMO it makes sense to makeJITModuleimplementSend.
Do you want me to PR for this, or would you rather do it yourself?
If you don't mind opening a PR, please do. Otherwise I might do it somewhere in the next couple of days.
Last updated: Dec 06 2025 at 05:03 UTC