jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.7k stars 728 forks source link

[Vue 2] Memory leak issue #696

Open Hironari-Saito opened 1 year ago

Hironari-Saito commented 1 year ago

Thank you for providing this wonderful library.

We are considering using it in our project. However, during the process, we encountered a memory leak issue, and we would like to report it.

Overview

In Vue 2, there is a memory leak issue where components are not completely cleared and remain in the internal state even after being cleared.

Details

Even after adding Vue 2 components using addNode, when you call clear, the Vue instances remain, leading to a memory leak issue.

Steps to reproduce

  1. Set up Drawflow.
  2. Add a large number of Vue components using addNode.
  3. Call the clear method.
  4. Open the developer tools and enter window.__VUE_HOT_MAP__ in the console. You will notice that Vue instances, which should have been cleared, are still present.

Here is my POC repository.

When running Memlab, a tool used to check for memory leaks, the following results are obtained.

スクリーンショット 2023-05-17 14 49 08

Expected behavior

When performing a clear operation, it is recommended to call $destroy on the Vue instance and remove the instance completely.

Environment

Additional information

While we haven't tested it, Vue 3 might also be affected by this issue.

jerosoler commented 1 year ago

Hi! @Hironari-Saito

Thanks for your detailed issue.

I have also seen your PR.