ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
448 stars 92 forks source link

`--watch` option leaks browsers #27

Closed matklad closed 5 years ago

matklad commented 5 years ago

Don't have time to write a detail bug-report, but TL;DR is that running

./node_modules/asciidoctor-pdf.js/bin/asciidoctorjs-pdf -v ./src/slides.adoc --template-require ./src/template.js  --watch

Eventually allocates 10GB of memory. Don't know what exactly is allocated: htop does not show that any particular process allocates a lot of memory, but the total mem usage is high, and system becomes unresponsive.

Hypothesis: we leave behind some processes, which don't use a ton of memory by themselves, thus dodging the htop.

matklad commented 5 years ago

Yep, there's a ton of Chromium processes in background.

ggrossetie commented 5 years ago

Nice catch, we should probably use a try/finally and close the browser: https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#browserclose

EDIT: or reuse the browser instance in watch mode ?

matklad commented 5 years ago

I guess we should do both: closing resources is always a good idea :-)

ggrossetie commented 5 years ago

:+1: Let me know if you want to submit a pull request, otherwise I will do it later today :wink:

matklad commented 5 years ago

Let me know if you want to submit a pull request, o

I want, but I absolutely don't have time :-)

ggrossetie commented 5 years ago

No worries I will take care of it, thanks for taking the time to report this issue :+1: