Hopding / pdf-lib

Create and modify PDF documents in any JavaScript environment
https://pdf-lib.js.org
MIT License
6.77k stars 647 forks source link

Update PDFObjectParser.ts #1653

Closed UnderKoen closed 2 months ago

UnderKoen commented 2 months ago

What?

Closes an memory leak.

Why?

When combing many large PDF's the memory usage is through the roof.

How?

By creating an new buffer instead of an view the reference to the orginal buffer is removed and can be picked up on garbage collection.

Testing?

New Dependencies?

No

Screenshots

N/A

Suggested Reading?

No

Anything Else?

Checklist

UnderKoen commented 2 months ago

After some more testing I don't think this is the solution to the problem. When an Buffer (Node) is supplied this is an issue because Node slice returns an view.