I used Chrome Timeline to try and track some memory leaks on my page. I discovered one specific memory leak that occurs as a result of creating web workers who cannot figure out how to get rid of it.
I deleted the page to just load the web worker and do nothing. Every time I refresh a page, the number of times a document is viewed in chronological Chrome mode is constantly increasing by 1. If I comment on a call to the Worker constructor and start updating the page, the number of documents increases and then decreases, actually remaining the same. Manual completion / closing of the worker does not fix the problem (although I see the worker disappearing when I look at the "Sources" tab of the developer tools).
Here is my cropped .htm file. I can reproduce the problem with this short html / javascript snippet:
<html>
<script type="text/javascript">
var worker_blob = new Blob(["var test = 1;"]);
var worker_url = window.URL.createObjectURL(worker_blob);
var worker = new Worker(worker_url);
window.URL.revokeObjectURL(worker_url);
</script>
</html>
source
share