ionic-framework: Memory Leak on Modals after dismiss

Bug Report

Ionic version:

[x] 4.0.0-beta.13

Current behavior:

When Modal (pop up) is displayed and then dismissed, it leaved Detached HTMLElement (memory leaks) behind.

Expected behavior:

Modal dismiss should clean up the memory allocation

Steps to reproduce:

The sample given at the docs is enough to produce the problem. When you have larger components used as the base for the modal, the issue becomes more dramatic.

Related code:

The code to launch the modal:

export class HomePage { constructor(public modalController: ModalController) { }

async presentProfileModal() {        
    const modal = await this.modalController.create({
        component: TestModalComponent,
        componentProps: { value: 123 }
    });

    await modal.present();
}         

}

Please find the component code below. The only added method is related to modal dismiss.

closeModal() { this.modalController.dismiss(); }


Other information:

Ionic info:

Ionic:

   ionic (Ionic CLI) : 4.2.1

System:

   NodeJS : v8.9.4
   npm    : 6.4.1
   OS     : Windows 7

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Can you please follow the issue template? Ionic 4.2.1 is not the ionic version, but the CLI version