Memory leaks 如何处理angular 10中的js内存堆问题

Memory leaks 如何处理angular 10中的js内存堆问题,memory-leaks,out-of-memory,angular10,Memory Leaks,Out Of Memory,Angular10,这是我的第一个angular应用程序,它几乎完成了开发。现在我正在测试我的应用程序。打开一个组件几分钟后,我的应用程序内存不足,崩溃 对于一个特定组件,我必须每5秒刷新一次数据 //This is the connectableObserable Interval this.selectData$= interval(5000).pipe( takeUntil(this.ngUnsubscribe), startWith(0),

这是我的第一个angular应用程序,它几乎完成了开发。现在我正在测试我的应用程序。打开一个组件几分钟后,我的应用程序内存不足,崩溃

对于一个特定组件,我必须每5秒刷新一次数据

//This is the connectableObserable Interval    
this.selectData$= interval(5000).pipe(
          takeUntil(this.ngUnsubscribe),
          startWith(0),
          switchMap(_ => forkJoin([ eg.service.getall() ])),
          multicast(() => new Subject())
        ) as ConnectableObservable<any>; 
    
        this.dataBinding();
        this.selectData$.connect();

//This is where I subscribe the Interval and refresh the data
    dataBinding(){
        this.dataBindingSubscription$=this.selectData$
        .pipe(
          takeUntil(this.ngUnsubscribe)
        ).subscribe( (res: any) => {  
        
        })
      }

//This is how I unsubscribe
      ngOnDestroy():void{
        this.ngUnsubscribe.next();
        this.ngUnsubscribe.complete(); 
    
        this.dataBindingSubscription$.unsubscribe();
      }
//这是可连接的时间间隔
此.selectData$=间隔(5000).pipe(
takeUntil(此为ngUnsubscribe),
startWith(0),
switchMap(=>forkJoin([eg.service.getall()]),
多播(()=>新主题())
)作为可连接的,可观察的;
这是.dataBinding();
这是.selectData$.connect();
//这是我订阅间隔和刷新数据的地方
数据绑定(){
this.dataBindingSubscription$=this.selectData$
.烟斗(
takeUntil(this.ngUnsubscribe)
).subscribe((res:any)=>{
})
}
//这就是我退订的方式
ngOnDestroy():void{
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
此.dataBindingSubscription$.unsubscribe();
}
我如何解决这个问题?我只是打开这个页面几分钟,js内存堆大小已经>1000