Re: Slow init:stop/0 due to purging modules

Mikael Pettersson <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAM43=SPcjNz-MVcUF1D5-ToTE+Zg2DZmq2xTJvR7uMufVs+ewg@mail.gmail.com>
On Tue, Jul 6, 2021 at 4:52 PM Frank Hunleth
<[email protected]> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.