Slow init:stop/0 due to purging modules

Mikael Pettersson mikpelinux@REDACTED
Wed Jul 7 10:05:57 CEST 2021

On Tue, Jul 6, 2021 at 4:52 PM Frank Hunleth
<fhunleth@REDACTED> wrote:
> 1. Does it make sense for unloading all modules to take longer than
> loading them? Just want to sanity check that unloading isn't slow by
> design.

Unloading a module is slower than loading it, since the unload needs
to check all processes to see if any of them currently run in that
module, if they do they get killed. The VM cannot permit the unload to
create dangling references into the unloaded code.

> 2. If the VM is going to exit anyway, is do_unload necessary for
> graceful shutdown?

I can't immediately see why unload would be needed in this scenario. I
hope someone from the OTP team can enlighten us.

More information about the erlang-questions mailing list