Serious memory leak with OSMbuildings ? Destroy does not work fine

Hello
I think there is a memory leak when uses OSM buildings ( and other elements…)
You can use this code sandcastel code:

var viewer = new Cesium.Viewer(‘cesiumContainer’, {
requestRenderMode: true,
maximumRenderTimeChange: Infinity,
timeline: false,
animation: false,
baseLayerPicker: false,
sceneModePicker: false,
terrainProvider: Cesium.createWorldTerrain(),
imageryProvider: Cesium.createWorldImagery()
});
viewer.scene.primitives.add(Cesium.createOsmBuildings());
viewer.clock.currentTime = Cesium.JulianDate.fromIso8601(‘2020-09-01T16:23:19.06128571429871954Z’);
viewer.scene.globe.depthTestAgainstTerrain = true;

viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-122.4175, 37.655, 400),
orientation : {
heading : Cesium.Math.toRadians(0.0),
pitch : Cesium.Math.toRadians(-15.0),
}
});

window.setTimeout ( ()=>{viewer.destroy(); viewer=null; } , 10000)

As you can see the last line is a ‘destroyer’ function.-

1.- Comment this last line. Take a memory snapshot, you will get : 109 Mb ( more or less)
2.- Uncomment the destroyer, wait 10 seconds… take a mem snapsot . You will get 91 Mb
3.- Uncomment the OSM , wait 10 seconds: you will get 51 Mb

So … What is happend wiht OSM ? I have 40Mb of memory leak…

And… I have problems with a las file loaded in cesium.ion…and used as an Cesium3DTileset.
The same… after destroy the viewer I keep having a lot of Uint16Arrays I can view on the chrome memory snapshot… ( 90Mb … )

Any idea ?
The problem is real…

Also I see how the cesium webworkers are not terminated ? This can be the problem ?

Thanks in advance

Hi there @tonn,

What browser are you seeing this in?

Sometimes browsers can hold on to memory until the garbage collection is forced to run, as described in this comment.