pdf2json
pdf2json copied to clipboard
how to free memory used by pdf2json?
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
I created a new pdftojson based on xpdf in c. Perhaps it will work better for you? https://github.com/ldenoue/pdftojson
On Feb 20, 2017, at 3:24 AM, saye [email protected] wrote:
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
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
@ldenoue thank you, I will try it.
you can try pdfParser.destroy() to free the memory