CesiumGS / CesiumGS/cesium

when we use viewer.destroy after viewer.flyTo(some entity or dataSource),will cause memory leaks

Open
#8,378 2 comments 0 reactions 0 assignees View on GitHub
category - entity category - memory/performance type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Sandcastle example: [Example](https://sandcastle.cesium.com/#c=vVNJj5swFP4rT1zGSBkDnemlQ6JWadQeukhp1UPFxQOPYNXYkf1IylT572O2Ejr3+mDkb3mbzUlYOEk8o4U1aDzDFp1sav6jx9hN3h+3RpOQGu1N+JBp8CvTJ+9ETZLapXPXY+zPoLOYk9AHhfAGRqhbuTG2kFoQOk+Mzv2k5aU19Xs8WETHbpMk5vEK7vr9Non7773fw9UcsPahrBRqjrY1ylj+Yb/bfeFnSdU7dawEi/nra5s1JEgaPds+C6o4mb0opNCO3S/k+JtsU2DxEeWhIm+6i7vlC5o11cQlIzdQl0xfuuENw+b95CQ6LoqCDWPs2ExHESQcnoypvxvIhYbSTwFqrI1th6E3Dn8O9Bp8OehtsgT2Fw6nQY+phlhTEk4ValY2Ou/6ZuHVpcy32Sj1MONjnAIdWdOy8AW1tPRtXgCVw6kS39QrDqVqx560oWVfV2l61f+uNlgFqaNW4WZA38r6aCxBYxXjPCKsj6p7rNFjk/9C4rlznS+NJlNayBPIYp0F//wxWQC5Es55pvRZv8knzIJNGnn9wqaMf3H68PWEVom2k1TJ5tMAcs7TyB9fusgY9SjsVcRn)
Browser: Chrome
1. when use zoomTo will never case;
2. use flyTo will like this:
![QQ截图20191108182611](https://user-images.githubusercontent.com/24953508/68469581-69e03b00-0255-11ea-876a-b1943ff15fa2.jpg)
3. we guess something happened at scene.postRender -> updateZoomTarget -> viewer._zoomIsFlight -> camera.flyToBoundingSphere -> cancel when viewer.destroy
so we try
```javascript
viewer.flyTo(xxx).when(()=>{
viewer._zoomIsFlight = false
})
```
before use destroy, it still cannot free entity object,so it may happend when use flyTo method

Contributor guide

Open the contributing guide

Research direction

Start with the linked Sandcastle example in Chrome and reproduce the difference between zoomTo and flyTo before viewer.destroy. Trace the issue's stated path from scene.postRender through updateZoomTarget and viewer._zoomIsFlight to camera.flyToBoundingSphere, then verify that destroying the viewer releases the entity object without requiring the proposed internal flag change.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.