CesiumGS / CesiumGS/cesium

Memory leak when removing textured models

Open
#4,645 10 comments 0 reactions 0 assignees View on GitHub
category - model/gltf type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Reported on the forum: https://groups.google.com/forum/#!topic/cesium-dev/7jeBHcXC7L4

When many textured glTF models are added to the scene and then removed, the reported CPU memory of the Cesium app stays high.

> I used the Model.fromGltf to load 200+ individual textured 3D building models, then add them to scene.primitives to render in Cesium. When the render finished,I used the scene.primitives.removeAll() function, the models were all removed and destroyed, but the CPU memory occupancy is still high.
> 1. Just render the Cesium globel without any primitive or entity, the original CPU memory occupancy is about 3.5GB.
> 2. When finished rendering the 200+ individual textured models, the CPU memory occupancy is about 8.6GB.
> 3. When removed all the 200+ individual textured models, the final CPU memory occupancy is about 4.2GB.
> 4. The 200+ individual textured models have 4600+ files(.gltf, .glsl, .bin and .jpg).The .gltf files are about 9 MB, .glsl files are about 300 KB ,.bin files are about 6 MB and the .jpg files are about 80 MB.

I still need to investigate properly, but this seems like a big enough issue to mark for next release.

Contributor guide

Open the contributing guide

Research direction

Start with the forum report and reproduce the case by loading many textured models with Model.fromGltf, adding them to scene.primitives, and calling scene.primitives.removeAll(). Investigate why CPU memory remains elevated after the models are destroyed; done means the reproduction no longer retains the reported excess memory.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.