intbot / ng2-pdfjs-viewer

An angular component for PDFJS and ViewerJS (Supports all versions of angular)
Apache License 2.0
225 stars 113 forks source link

Fix memory leak #224

Closed Akxe closed 11 months ago

codehippie1 commented 1 year ago

Let me test this first

On Mon, May 22, 2023, 6:29 AM Adam Eisenreich @.***> wrote:


You can view, comment on, or merge this pull request online at:

https://github.com/intbot/ng2-pdfjs-viewer/pull/224 Commit Summary

File Changes

(1 file https://github.com/intbot/ng2-pdfjs-viewer/pull/224/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/intbot/ng2-pdfjs-viewer/pull/224, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEL3UNRCCXUHDFMTYPDQLO3XHM5Z7ANCNFSM6AAAAAAYKHOTIA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Akxe commented 11 months ago

Just rebased. This fixes the createObjectURL memory leak using revokeObjectURL.

MDN Example

codehippie1 commented 11 months ago

@Akxe, You are super quick. Appreciate it. Merging

provegard commented 11 months ago

Looks like there is still a leak when the component is destroyed, right?

Akxe commented 11 months ago

This PR fixed one. Did you find any other?

provegard commented 11 months ago

I just noticed that the added relaseUrl function is not called in ngOnDestroy (which doesn't exist), so when the component is destroyed, the last object URL isn't revoked.

Akxe commented 11 months ago

Well... It must have gotten removed when rebasing the PR on the new master...

I am out of the office. Would you create the mentioned fix?