typescript - DOM memory leak with angular 2 -
my company building large scale application , have created large 5000+ line component. said, we've came across place in application has memory leak. feel adding thousands of controls dom.
have narrowed down we're pushing objects array, , when garbage collector cleans don't thing removing of nodes dom. of said have hit brick wall in trying clean appreciated. have created plnkr similar we're doing , have reproduced memory leak on smaller scale our application. can please tell me why happening , how fix it?
the code @ is:
.html
<div> <div class="col-sm-1 left-column"> <div> </div> <div *ngfor="let line of lines">{{line.linename}}</div> </div> <div class="col-sm-11"> <div *ngfor="let column of columns" class="col-sm-1"> <span class=column-header>{{column?.title}}</span> <div *ngfor="let line of column?.linemodels"></div> </div> </div>
.ts
export class examplecomponent implements oninit, ondestroy { constructor(private exampleservice:exampleservice){ } private lines:linemodel[]=[]; private columns:columnmodel[]=[]; ngoninit(){ this.lines = this.exampleservice.getlines(); this.columns = this.exampleservice.getcolumns(); } ngondestroy(){ //i have tried lines.removeat(line.lineindex) doesnt remove dom. } }
Comments
Post a Comment