TaTo30 / vue-pdf

PDF component for Vue 3
https://tato30.github.io/vue-pdf/
MIT License
358 stars 51 forks source link

Switching between multiple PDFs causes crash #103

Closed courdek closed 2 months ago

courdek commented 3 months ago

When loading and switching between multiple PDFs, the browser tab will crash after n times. This can be reproduced on the documentation page by clicking "Next PDF" approximately 30 times (I imagine this will vary depending on the computer).

Inspecting the memory usage shows a new Javascript VM instance being created every time the PDF is changed. Essentially it acts like a memory leak. Eventually it overwhelms the tab and crashes.

Additional context image image

GuoyiCoding commented 2 months ago

I used PDFDocumentProxy.destory() to destroy the previous document instance and terminate the worker when source of pdf has changed.

Now, it seems that every JavaScript VM instance created before can be destroyed normally.

Before before

After after

see https://github.com/TaTo30/vue-pdf/pull/105