vsf-capybara icon indicating copy to clipboard operation
vsf-capybara copied to clipboard

Memory increases after each page reload.

Open one1note opened this issue 4 years ago • 4 comments

Current behavior

Memory is never released and thus memory usage keeps increasing after each page reload. In the default VSF theme the template imports are tagged with webpackChunkName and thus dynamically imported, in the Capybara theme however the imports are missing the webpackChunkName comment, which seems to cause the memory leak.

Expected behavior

GC reclaims unused memory.

Steps to reproduce the issue

  1. Install the latest VSF with the Capybara theme in Docker.
  2. Run, configure and import the demo data set
  3. Run 'docker stats'
  4. Browse to your vsf instance and keep reloading the page.
  5. You should see the memory usage of your vsf container increase with each reload.

Can you handle fixing this bug by yourself?

  • [X ] YES
  • [ ] NO

Environment details

  • Browser: Firefox 78.0.2 (64-bits)
  • OS: Windows 10 pro 2006
  • Code Version: latest Master (1.0.3)

Additional information

one1note avatar Jul 11 '20 09:07 one1note

@one1note In which mode did you run VSF with Capybara theme: in development or production mode?

psmyrek avatar Jul 16 '20 07:07 psmyrek

@psmyrek In production mode

one1note avatar Jul 16 '20 08:07 one1note

Capybara theme uses multiple webpackChunkName annotations for pages (they are configured in router/index.js) and for other components (cart, search panel).

I've checked latest VSF with default theme and with Capybara theme and memory issue exists in both installation, in production mode, so this suggests that problem is somewhere else - outside Capybara theme, or even outside VSF - in external lib. This needs to be investigated.

VSF with default theme

default-theme

VSF with Capybara theme

capybara-theme

In both test cases Homepage was reloaded every 2-3 seconds.

psmyrek avatar Jul 16 '20 09:07 psmyrek

We've found that the main reason for memory leaks in our case was this change: https://github.com/vuestorefront/vsf-capybara/pull/45#discussion_r365103985

gorbunovav avatar Jun 06 '22 11:06 gorbunovav