primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.51k stars 1.23k forks source link

DataTable: There seems to be memory leak in expansion feature #6223

Open yhseokshow opened 2 months ago

yhseokshow commented 2 months ago

Describe the bug

(App.vue)
...
let intervalId = 0;

const fetchDataInterval = () => {
  ProductService.getProductsWithOrdersRandom().then(
    (data) => (products.value = data)
  );
};

onMounted(() => {
  fetchDataInterval();
  intervalId = setInterval(fetchDataInterval, 5000);
});

onBeforeUnmount(() => {
  clearInterval(intervalId);
});
...
(ProductService.js)
...
  getProductsWithOrdersRandom() {
    let randLength = Math.floor(
      Math.random() * this.getProductsWithOrdersData().length
    );
    return Promise.resolve(
      this.getProductsWithOrdersData().slice(0, randLength)
    );
  },
...
JS Heap Size DOM nodes JS event listener
begining 205 MB 43685 17000
2 minutes later 342 MB 78366 29585
25 minutes later 696 MB 168978 61863

First Performance Monitor snapshot First Performance Monitor snapshot

Second Performance Monitor snapshot (after 2 minutes) Second Performance Monitor snapshot (after 2 minutes)

Third Performance Monitor snapshot (after 25 minutes) performance-monitor-test-4

As times go, JS heap size, DOM nodes and JS event listener are increasing steadily.

Reproducer

https://stackblitz.com/edit/rxcrqe

PrimeVue version

4.0.4

Vue version

3.4.30

Language

ES6

Build / Runtime

Vite

Browser(s)

Chrome 127.0.6533.100 build

Steps to reproduce the behavior

  1. click every expansion to open (expand all rows.)
  2. monitor with devtools performance monitor

Expected behavior

No response

IvanCausera commented 1 month ago

I noticed today that there are also memory leaks when navigating between pages. To replicate the issue:

  1. Visit the PrimeVue Button page: https://primevue.org/button/ Captura de pantalla 2024-09-19 163955
  2. Use Chrome DevTools (or another browser's developer tools) to take a memory snapshot. Captura de pantalla 2024-09-19 163947
  3. Navigate to the DataTable page.
  4. Continuously switch between the Button and DataTable pages 10 to 20 times. Captura de pantalla 2024-09-19 164004
  5. After performing these steps, the memory usage increases significantly, rising from an initial 30 MB to around 850 MB. This indicates a possible memory leak associated with these components. Captura de pantalla 2024-09-19 165100

It seems that the memory is not being properly released, leading to substantial growth over time.

prempopatia commented 1 month ago

I am also facing the same issue in primevue without SSR. On every refresh memory is incresing only and after considerable amount of time, it is even htiing 1GB. I tried with primevue version 4.0.7 as well but no luck.

Can anyone help me?

mertsincan commented 1 week ago

Thanks a lot for your report! I'll check and get back to you.

is-paranoia commented 4 days ago

I'm seeing the same problem. Version 4.0.7

Removing PrimeVue components causes the leak to disappear or become negligible