vuepress icon indicating copy to clipboard operation
vuepress copied to clipboard

javascript heap explodes with vuetify 2 based custom theme

Open jaunt opened this issue 5 years ago • 8 comments

  • [x] I confirm that this is an issue rather than a question.

Bug report

After the client and server are compiled successfully, during the "Rendering static HTML" phase, the rendering of pages gets slower and slower until a crash:

Steps to reproduce

Check out the repo below. Yarn install. vuepress build docs.

https://github.com/jaunt/vuepress-vuetify2

What is expected?

The speed of each page rendering should be constant (they are duplicated md files). Memory should not run out.

What is actually happening?

Rendering gets slower and slower until javascript runs out of heap memory:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Other relevant information

  • Output of npx vuepress info in my VuePress project:

Environment Info:

System: OS: macOS High Sierra 10.13.6 CPU: (8) x64 Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz Binaries: Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.10.3 - ~/.nvm/versions/node/v10.16.0/bin/npm Browsers: Chrome: 76.0.3809.132 Firefox: 69.0 Safari: 13.0 npmPackages: @vuepress/core: 1.1.0 @vuepress/theme-default: 1.1.0 vuepress: ^1.1.0 => 1.1.0 npmGlobalPackages: vuepress: Not Found

jaunt avatar Sep 21 '19 18:09 jaunt

Sorry but we would not help you solve the problem which is relative to the out-of-memory.

What we can do is to build a strategy of detecting build performance to help you to know the memory footprint for each stage.

ulivz avatar Sep 22 '19 14:09 ulivz

Hi, thank you for looking into it! Out of curiosity, do you suspect there is a bug in how I am using vuepress in the minimal example I posted above, or do you think there is a bug in Vuetify 2.0?

jaunt avatar Sep 22 '19 16:09 jaunt

Hi @jaunt, when using Vuetify 1.5, I found that trying to pre-render components would cause the error that you describe. E.g. if you have a top toolbar or footer on each page, try wrapping them in <ClientOnly> and see if that helps.

richardcov avatar Sep 22 '19 21:09 richardcov

Potential memory leak?

https://github.com/nuxt/nuxt.js/issues/3465

meteorlxy avatar Sep 23 '19 06:09 meteorlxy

Thanks for the tips @richardcov & @meteorlxy

jaunt avatar Sep 23 '19 19:09 jaunt

Maybe related to #1560

meteorlxy avatar Dec 30 '19 02:12 meteorlxy

Hi @jaunt, when using Vuetify 1.5, I found that trying to pre-render components would cause the error that you describe. E.g. if you have a top toolbar or footer on each page, try wrapping them in <ClientOnly> and see if that helps.

I have encountered the same problem when using vuepress with vuetify theme. And adding <ClientOnly> to the header and drawer components successfully solve this problem. Thanks a lot.

sunziping2016 avatar Jan 16 '20 01:01 sunziping2016

You can try --max-concurrency option - it helped me reduce memory usage during a build from ~8G to ~3.5G.

th0r avatar Nov 25 '22 05:11 th0r