Cesium WebGL Contexts Error

305 views
Skip to first unread message

justk...@gmail.com

unread,
Aug 22, 2018, 3:36:56 PM8/22/18
to cesium-dev
So I'm currently working on an application including Cesium. I have a page that generates and removes views as certain data objects are selected. However, despite using .destroy on the views and verifying that they are destroyed (by using isDestroyed() which is returning true), I am continuing to have an error that "Too many active WebGL contexts. Oldest context will be lost." Upon clicking again, it blows up my application.

I am not sure what to do at this point. For a reference of what I am saying, someone shared their code snippet on the sandcastle, and I am able to recreate the error by adding and deleting their view over and over (around 21ish times). Attached the sandcastle link for reference. Is there any way to fully destroy/have cesium viewers let go of the WebGL to actually remove or is this a bug? Thanks in advance.

sandcastle link mentioned above.

https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html#c=jVdrb9s2FP0rRL5Ebj3Zah5rnaSY62ZFh7QxYq/FsAwFLdE2UUoUSMquO+S/75CUrEecrkYQ0+J9P869WhZZbLjMSKwYNSzokX/vM4LPhiqy4WzLFLkiGduSCdO8SMNP7llwHLufE5kZyjOmjvsVo/3wbCnfyG8jsqRCsz4ZDN5yTReCkff+hmx5smKm5tBMMGfI+yzhMTVSHWDeE0FBSdWQsJaFSMYZT+HHiBhVOF5ynTle6i7Aq2sWw5SC9VMlNzxh0Fj66GPxWSqRzD1J0PNcD72L+8wfB4NSsuCrteHZiiyoZgmBdbrIBqnEIZeaN3T6eIY6ZhkLV0IuWMicjJtKxJWz+7GOhOVmDXu1o9KSmDUOmiwYvhP8YpUzJEGw8pxRFT6p1EmbQ9h4BQ5tSicfa58x42QrmiUyJVmRLlAPmsHNpVQkhmdcG5YZopguhNGlzjKOH6hZh5qZO8f+0XHPwByc9DpKFrLIEk3kksgCCnhaCJcsYnjK6oLUhioDM0v5fxSC0+wtchUulUztIbCl6g4vhtFZn7zAH76i855VWcuR+UExNElmDG4lOnC6+uTkfNhv1n9NHPSaXnygX1GghWJV13BNqI9eAk6FkFlf2kmJhYy/hk7THJcwyZ3t8wzyLw4Sy3xPK/MfkcaFUsjNz0p2/5GqF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Bz7rJZr5/yXSeQbcOIyzGFJudp+q97Pq5c3pmGEMxlQb4Qb7XEqxoOpNYQy6+fgttn4ld3hdq3ae+pWvJbXGJSQP3TEWYr+3tAkTL/LwrV2ICiGs8T9h3cT58f/GtV2G5KP+0aU2O8Fee+rfeJpL4FGhRIDuMAxlCXI9WBQIOtZgrS3n5aBiukz4hvDk6v6o82J7f0RiQbXGzRKO2Aa5P3p9OQB9i02gw7FY3m6YEnRnSdbR6xv/MAzDywF+PuYy3v+GxP8A

Omar Shehata

unread,
Aug 24, 2018, 1:17:45 PM8/24/18
to cesium-dev
Looks like there is already an issue for this:


It looks like this might be an issue with how the browser frees up memory. I suggested that perhaps Cesium can allow users to re-use WebGL contexts. In the mean time you might try to dig into the source and do this yourself (and if you get it to work we'd absolutely appreciate a contribution!)

Or perhaps you can destroy all entities and hide/re-use the viewer as a workaround? 
Reply all
Reply to author
Forward
0 new messages