modesty / modesty/pdf2json

how to free memory used by pdf2json?

Open
#113 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
2.2k
Forks
394
Avg merge
3d 5h
Merged PRs (30d)
7

Description

I have a server that run four process to handler client side pdf.
I found that when client side send a 10mb pdf file, one process will used 400mb memory and never free it.
When run it for long time and receive some big pdf, it will take me about 4gb memory, and make other app down.
I have a test code like this

const pdfParser = new PDFParser(this, 1);

pdfParser.on('pdfParser_dataReady', pdfData => {
    console.log('--------------raw-----------------');
    console.log(pdfParser.getRawTextContent());
});

pdfParser.loadPDF('/Users/saye/Downloads/Gradle_Recipes_for_Android.pdf');
let server = http.createServer((req, res) => {
    res.write('hello');
    res.end();
});
server.listen(2345);

so what should I do to make memory free

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the memory growth with the shown PDFParser example and the referenced Gradle_Recipes_for_Android.pdf file, then observe memory across repeated calls to loadPDF and pdfParser_dataReady. Done means the cause of retained memory is identified and memory is reclaimed after processing, with the behavior verified under repeated large-PDF requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.