valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.52k stars 1.69k forks source link

Detatched DOM Tree while using Modal #3919

Open saurav1005 opened 6 years ago

saurav1005 commented 6 years ago

We are using ngx-bootstrap/Modal module extensively in our application. While profiling the application we could see the Memory and nodes going up and on taking Heap Snapshots it was pointing towards opening a Modal Window backdrop instance.

Heap Snapshot for current application pointing to backdrop instance - modal

Tried replicating this with the current ngx-bootstrap example page for modals - https://valor-software.com/ngx-bootstrap/#/modals largemodal - ngx-bootstrap

Above snapshot from ngx-bootstrap page is for a Large Modal without refreshing the page and invoking the modal component 2-3 times.

Is this issue faced by anyone else? Or anything incorrect with using the Large Modal approach for Modals.

shwtvrm8 commented 6 years ago

Even I am facing an issue with the application when modal is used. Can see detatched DOM nodes in memory even after Modal window is hidden or component gets destroyed. Anyone looking into this issue?

shubh9422 commented 6 years ago

We are using ngx-bootstrap/Modal and facing issue after the modal is closed or the component is destroy in which modal is open the modal DOM still uses memory.

valorkin commented 6 years ago

Need to add more cleanup

ozorOzora commented 5 years ago

Any news on this?

avalonabecker commented 5 years ago

@valorkin - I am having a similar issue with "ngx-bootstrap": "^3.1.4", where we are rendering components inside the modal. When we close the modal, all the memory is not garbage collected. I've been looking for a way to either destroy all modals or just the current one using bsModalRef or another object accessible from angular. Would you be willing to add an example of how this cleanup can be done? (I am using same setup like https://github.com/valor-software/ngx-bootstrap/issues/2290)