Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDFDocumentProxy : destroy() doesn't work : memory bloat #414

Closed
ortmann64 opened this issue Nov 22, 2018 · 4 comments
Closed

PDFDocumentProxy : destroy() doesn't work : memory bloat #414

ortmann64 opened this issue Nov 22, 2018 · 4 comments
Milestone

Comments

@ortmann64
Copy link

ortmann64 commented Nov 22, 2018

Bug Report or Feature Request (mark with an x)
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [X] Bug report -> please search issues before submitting
- [ ] Feature request
- [ ] Documentation issue or request
Ionic:

   ionic (Ionic CLI)  : 4.3.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.5, (and 6 other plugins)

System:

   ios-deploy : 1.9.2
   ios-sim    : 6.0.0
   NodeJS     : v11.2.0 (/usr/local/bin/node)
   npm        : 6.4.1
   OS         : macOS
   Xcode      : Xcode 10.1 Build version 10B61

Hi,

i wondered why my Ionic app stuck after exactly 9 times loading a pdf.

After some debugging in Chrome DevTools i found out, that each Document stays in the memory and makes the app increasingly slower.

On component destroy the Pdf is getting destroyed.

import { PDFDocumentProxy } from 'ng2-pdf-viewer';

@Component({
  selector: 'pdf-viewer',
  templateUrl: 'pdf-viewer.html'
})
export class PdfViewerComponent {

    public loadedPdf: PDFDocumentProxy;

    constructor() { }

    afterLoadComplete(pdf: PDFDocumentProxy) {
        this.loadedPdf = pdf;
    }

    ngOnDestroy() {
        this.loadedPdf.destroy();
    }

}
<pdf-viewer
    [src]="pdf"
    [render-text]="false"
    [fit-to-page]="true"
    (after-load-complete)="afterLoadComplete($event)"
    (page-rendered)="pageRendered($event)"
    (error)="onError($event)"
    style="display: block;">
</pdf-viewer>

I don't know what i can do next. I tried some things, but the app still gets slower.
Thank you for your help!

@strerene
Copy link

Hey,
we are experiencing the same issue.

After opening and clsing a document 6 times, the PDFViewer stays in memory exactly 6 times. This makes the library unusable on iOS since it starts displaying only blank pages after a while and decreases the performance of the whole application drastically.

image

@jitendrak414
Copy link

Hey
we are facing the same issue,
I am really thankful if anyone can help me out.

Thanks

@vishnu-dev
Copy link

@VadimDez or anyone, Do you have any idea on how to solve this?

@VadimDez VadimDez added this to the 6.0.0 milestone Oct 15, 2019
@VadimDez
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants