antonreshetov / vue-glide

A slider and carousel as vue component on top of the Glide.js
https://antonreshetov.github.io/vue-glide/
MIT License
269 stars 39 forks source link

Memory Leak issues #43

Closed dfabreguette closed 3 years ago

dfabreguette commented 4 years ago

Hi guys, according to this blog post https://vuejs.org/v2/cookbook/avoiding-memory-leaks.html, it looks like "glide" instance is not properly destroyed on component destroy. I guess the simple solution is to add this :

beforeDestroy() {
   if (this.glide) this.glide.destroy()
}

Do you want a PR for that ?

denysaw commented 4 years ago

А ведь утечка-то есть... Антон, хотя б последний файл-то замердж (c beforeDestroy()). В SPA раз 5 релоадишь компонент и начинает тупить с каждым разом всё больше... (

M-Barari commented 3 years ago

@dfabreguette-ap , I saw your PR . As @antonreshetov didn't merged it ( he probably not gonna continue working on vue-glide ) , is it safe too use your repository for glide ? or can i simply use

 beforeDestroy() {
   if (this.glide) this.glide.destroy()
}

in my component were vue-glide is imported??

antonreshetov commented 3 years ago

There is no memory leakage. When a component is created, a new Glide.js instance is created and assigned to a local variable. When the component is destroyed, all local variables will also be destroyed, so there is no need to call Glide.js destroy method.

dfabreguette commented 3 years ago

Alright, thx !