I am noticing that in both Google Chrome and Microsoft Edge the Worker objects are not garbage collected. After running the following standalone simple test case, doing memory profile and checking for Worker class shows all the worker objects as retained.
How to ensure the worker objects are freed?
Juan Pablo Isaza
Off the top of my head I'd say that your problem lies with the
const w = new Worker... part. I'm guessing the garbage cleanup isn't taking because the value of
w cannot be reassigned, and in any case block cleanup is irrelevant because it's a detached process to begin with. Try changing it to
var w = new Worker..., leaving the rest unchanged.