Module unload/delete

I am sure i have missed the obvious,… but if i have loaded a large module, but then dont need it anymore, how do I unload / delete the module so resources can be returned to the core ! … Ready to be embarrassed

This is one thread that seems to try and answer your question: Re-defining a predicate in a new module file, vs. in a traditional file

The short answer seems to be, no, you cannot truly unload a module. But there seem to be workarounds depending on the use case?

What is in your large module? If it is data, you could probably read the file and assert its contents; then retract them when you no longer need it. This will get garbage collected.

Apparently there is also in_temporary_module/3 here: -- Module utility predicates

1 Like


yes im thinking ill have an empty predicate to retract all as you said…

next point of thinking is if i want re open it i have to reuse the module name. thinking ill just use modules and have an empty and fill predicate,…