Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak #208

Open
sz274071580 opened this issue Oct 24, 2019 · 7 comments
Open

Memory leak #208

sz274071580 opened this issue Oct 24, 2019 · 7 comments
Labels

Comments

@sz274071580
Copy link

Hello, when I use the ngx-color-picker component, I find that the memory can't be released, so the module that references the component can't release the memory. Is there any way to release the ngx-color-picker component memory?
Ngx-color-picker version 8.1.0
Angular version 8.1.0
I saw it through the memory monitor in the Chrome browser. There are two variables: ColorPickerComponent and ColorPickerDirective (4).

@sconix
Copy link
Contributor

sconix commented Oct 24, 2019

The dialog component is created when its opened for the first time, it is not destroyed after that for faster displaying of the dialog. I can not see the dialog using that much memory that destroying it after closing would make that much sense. I.e. I prefer usability over the tiny bit of memory it needs. Of course PR is accepted if there really is a need for option destroying the dialog component after closing.

@sz274071580
Copy link
Author

The dialog component is created when its opened for the first time, it is not destroyed after that for faster displaying of the dialog. I can not see the dialog using that much memory that destroying it after closing would make that much sense. I.e. I prefer usability over the tiny bit of memory it needs. Of course PR is accepted if there really is a need for option destroying the dialog component after closing.

Now the ngx-color-picker component does not release the memory, affecting the entire module that calls it can not be released, which is not a small memory overhead, how to release the memory?

@sconix
Copy link
Contributor

sconix commented Oct 24, 2019

I guess you can not without adding such feature. Of couse hard to say since I am not familiar with your setup. Never seen a setup where modules are released from the memory with Angular.

@sconix
Copy link
Contributor

sconix commented Oct 24, 2019

I think I only now understand what you are after :) I guess the issues is that the created component is not destroyed when the directive is destroyed. I will add destroying of the dialog component when the directive is destroyed for the next release.

@sz274071580
Copy link
Author

I think I only now understand what you are after :) I guess the issues is that the created component is not destroyed when the directive is destroyed. I will add destroying of the dialog component when the directive is destroyed for the next release.

That is what I mean, I look forward to the next version coming soon! thank you very much!

@sz274071580
Copy link
Author

sz274071580 commented Oct 31, 2019

1
To add one more point, these two variables cannot be destroyed when switching navigation, so that the parent component can not be destroyed, eventually leading to memory leaks! I remove the color component from the parent component, the parent component can be destroyed normally

@sconix
Copy link
Contributor

sconix commented Dec 25, 2019

I finally had time to look into this and the directive actually will destroy the component so I am not sure why this happens. Could be bug with the Angular even since at least I can not find any reason from this library since everything gets destroyed when directive onDestroy is called so everything should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants