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

Memory leak in encode #40

Open
murugu-21 opened this issue Jan 10, 2023 · 2 comments
Open

Memory leak in encode #40

murugu-21 opened this issue Jan 10, 2023 · 2 comments

Comments

@murugu-21
Copy link

murugu-21 commented Jan 10, 2023

We internally used this package for encoding/decoding large pdf files and noticed our instance crashing on around 2gb of files. The instance had free memory of 12gb! After hours of debugging we narrowed it down to the encode function of this library. I read the encode function code and tried to figure out why? But couldn't find a leak. But from our testing and debugging, I am sure there's a memory leak in encode function (in nodejs v8) @niklasvh

@carmenchapa
Copy link

I think I'm also facing a memory leak with this library, did you find a solution for it? @murugu-21

@murugu-21
Copy link
Author

murugu-21 commented Feb 10, 2023

Yes, just use the inbuilt Buffer library like below

const fileContent = 'abc';
const fileBase64 = Buffer.from(fileContent).toString('base64'); // same as encode(fileContent)
Buffer.from(fileBase64, 'base64'); // same as decode(fileBase64)

Hope it helps!

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

2 participants