vendredi 20 octobre 2017

PDFJS - memory shoots up to 1 GB and does not decrease even after destroying the loadingTask

I am developing an ember application - pdf viewer. I use the ember addon - ember-pdf-js. Here I have created a component that uses the 'PDFJS' object to render the pdf. I load the document using 'getdocument(url)' method of PDFJS. Here while scrolling through the pdf, in the task manager I noticed that the memory shoots upto 1 GB. Even after destroying the component, the memory consumed still does not decrease quickly. Also memory does not clear up if the byte-range requests in pending are aborted while destroying the component.

I want to know if I am missing out on something to be destroyed/cleaned. Below is the willDestroyElement method called in my component while it destroys. Kindly let me know if I am missing out on something.

    willDestroyElement() {
     let self=this;
     self._super(...arguments);
     get(self,'pdfLoadingTask').destroy(); //To destroy the byte-range requests once the component is destroyed
     set(self,'pdfLoadingTask',null);
    }




Aucun commentaire:

Enregistrer un commentaire