Re: Are ES Modules garbage collected? If so, do they re-execute on next import?

2020-06-30 Thread Gus Caplan
Modules in the spec are cached by specifier by modules that import them. Modules in major implementations are additionally cached for the entire realm by absolute URLs. I would say that for actual code (functions and classes and whatnot) leaks aren't really a problem. Even if you import a ton of

Are ES Modules garbage collected? If so, do they re-execute on next import?

2020-06-30 Thread #!/JoePea
I am curious: can modules be garbage collected if the exports are not references by anything anymore? And if so, will the module be re-evaluated the next time it is imported? I haven't tried an experiment to answer this yet. I'll be back to post findings if someone doesn't post an official answer

Re: Are ES Modules garbage collected? If so, do they re-execute on next import?

2020-06-30 Thread Isiah Meadows
Just to expand on that, if the module record itself is dereferenced (like if it's evicted from the cache somehow), then yes, it should be collected as appropriate. However, I'm not aware of any major implementation that offers that functionality. - Isiah Meadows cont...@isiahmeadows.com