-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Improving memory usage for PDF files loaded by chunks #5329
Comments
Thank you for looking into this. This is great (especially added testing). It's really hard to provide a feedback for a change that is not submitted as a pull request. When you decide to submit PR, make sure you are touching only the code that really needs to be changed, e.g. a reviewer will have a hard time understanding why you changed formatting at ChunkedStreamManager_onProgress under this change. See also https://github.com/mozilla/pdf.js/wiki/Contributing and https://github.com/mozilla/pdf.js/wiki/Style-Guide. |
I did read up on style & contribution guide and made lint & tests pass. Guide said to contact maintainers before creating a PR so this is what I am doing. :) |
One issue, style wise, with your patch is that you have indented with tabs in many places. Please replace all of them with spaces instead, before submitting the PR. Edit: As noted above, you should always avoid touching lines not directly related to the patch. This makes life easier for the reviewer, and should reduce the time it takes to review your patch! :-) |
Updated styling, created PR. |
Closing as, mostly a, duplicate of issue #5304. |
When file is loaded using pdfDataRangeTransport ChunkedStream will allocate memory for the whole file. In our case opening 1.9GB PDF file crashed practically every browser except 64-bit Chrome and even that one had 50-50 chance of crashing.
I have refactored ChunkedStream to use non-continuous memory. Reading (but not displaying) the same file now consumes 50MB or so. My commit is here:
bh213@161218e
I've added unit tests and the code passes all the tests. Still, I am not sure this is ready for pull request yet. There is no eviction (even though it is trivial to implement) and I'd like a review of both of my one line changes to core.js and worker.js. I haven't done any pull requests before so I probably did something else wrong too.
The text was updated successfully, but these errors were encountered: