Use Dialog to pop up Grid to display data. When destroying Dialog, there is a problem with memory release

Hi,

  1. Before the operation, take a memory snapshot

Image_8308_1719986290905

 2. Click the button to open the dialog. After loading the data, close the dialog.

Image_3020_1719986383757

 3.Collect garbage, take a memory snapshot

Image_4173_1719986512188


The initial size is 54.9m. After opening a Dialog, the memory size is 82.6m, an increase of 50.5%.


Example:https://stackblitz.com/edit/angular-4wcnp8?file=src%2Fpages%2Fbase%2Fdialog.page.ts,src%2Fapp.component.ts,src%2Fapp.component.html




1 Reply

PS Pavithra Subramaniyam Syncfusion Team July 4, 2024 11:04 AM UTC

Hi wills,


We have checked your sample and the arrays you are populating for the grid dataSource, and the columns are not destroyed properly. So, we suggest using the below solution and reference links to overcome the reported issue.


override ngOnDestroy() {

    this.dataSource.length = 0;

    this.columns.length = 0;

  }



https://4geeks.com/how-to/javascript-array-clear

https://stackoverflow.com/questions/1232040/how-do-i-empty-an-array-in-javascript


Regards,

Pavithra S


Loader.
Up arrow icon