# Unity-webgl out of memory

**URL:** <https://community.cesium.com/t/unity-webgl-out-of-memory/46421>\
**Category:** Cesium for Unity\
**Created:** [June 3, 2026, 8:50am UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421 "2026-06-03T08:50:51Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuzhe](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/yuzhe/32/28173_2.png) [@yuzhe](https://community.cesium.com/u/yuzhe)\
**Post date:** [June 3, 2026, 8:50am UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/1 "2026-06-03T08:50:51Z")

</div>

hi, I use CesiumForUnity to view global image data, in platform Windows, everything is fine.but in webgl,report error OOM, I upload screencapture,How can I optimize this?

 ![a5f14a0dc85140183c7562475b972824](https://global.discourse-cdn.com/cesium/original/3X/3/c/3c0a99a0d6acf85b7fc89b7032ba4997f4c6b437.png)

---

<div class="post-metadata">

**Author:** ![Cory\_Barr](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/cory_barr/32/14491_2.png) [@Cory\_Barr](https://community.cesium.com/u/Cory_Barr)\
**Post date:** [June 23, 2026, 8:11pm UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/3 "2026-06-23T20:11:14Z")

</div>

Hi yuzhe. Thanks for writing.

Since WebGL has much stricter memory limits than desktop builds, I wonder if any of these could help:

**Increase `Maximum Screen Space Error`** on your `Cesium3DTileset` component. A higher value will load fewer, lower-detail tiles and should reduce peak memory usage.

**Lower `Maximum Simultaneous Tile Loads`** to reduce how much data is in flight at once.

**Increase WebGL heap size**. If I recall correctly, you can set this in Unity Player Settings \> Publishing Settings \> WebGL Memory Size.

Let us know if any of those solutions work. If not, we can take a deeper look.

Running Cesium for Unity in WebGL is a new effort that comes with new challenges. Thanks for reporting the issue!

---

<div class="post-metadata">

**Author:** ![yuzhe](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/yuzhe/32/28173_2.png) [@yuzhe](https://community.cesium.com/u/yuzhe)\
**Post date:** [June 24, 2026, 8:20am UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/4 "2026-06-24T08:20:34Z")

</div>

thanks for your reply.I reduce **maximumCachedBytes** and \*\*maximumSimultaneousTileLoads,\*\*the memory has indeed decreased,but webgl still report OOM error sometime.my data is global imagery data, all over the world. The memory usage will increase when I browse more areas.So I must call **RecreateTileset** at certain times to release memory.

---

<div class="post-metadata">

**Author:** ![hv\_nico](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hv_nico/32/30670_2.png) [@hv\_nico](https://community.cesium.com/u/hv_nico)\
**Post date:** [June 26, 2026, 11:03am UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/5 "2026-06-26T11:03:07Z")

</div>

@yuzhe.

Very interesting workaround calling **RecreateTileset**. I will try this next week. Perhaps this can help me out a lot.

I have opened a thread in regards to the same issue a while back:

> [@WebGL Memory Accumulation](https://community.cesium.com/t/webgl-memory-accumulation/44906/3):
>
> Hey @janine ! Thanks for your reply. I have in fact tried that out. Through further profiling I have also found out that its not necessarily a problem on the Unity side of things. It seems memory there is released properly. My working theory is that this might perhaps be a memory leak in Cesium-Native on the web. Or perhaps, it is just silly JavaScript behaviour… I have taken a [screen capture](https://youtu.be/KbwRY-lUjAw), for better understanding. As you can see, the memory inside Unity is under control. In fact I have …

resulting in @Kevin_Ring opening [this](https://github.com/CesiumGS/cesium-unity/issues/660) issue on GitHub.

After further investigation and talking to some devs at Cesium Con about this, I think the issue described in GitHub is not the main source of this behaviour.

@adam_morris pointed me towards how WASM manages memory.

WASM memory using Unity’s WebGL Diagnostic Tools seems fine however (it uses between 200-500mbs for me). It is the JavaScript Heap itself that causes this issue, growing infinitely.  
(It might still be related to WASM - I am far from an expert when it comes to this. I just wanted to share the observations I made in the meantime.)

---

<div class="post-metadata">

**Author:** ![yuzhe](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/yuzhe/32/28173_2.png) [@yuzhe](https://community.cesium.com/u/yuzhe)\
**Post date:** [June 26, 2026, 11:26am UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/6 "2026-06-26T11:26:33Z")

</div>

@hv_nico  
Thanks for join this discussion. It seems we’ve both encountered memory issues. In my case, calling **RecreateTileset** method did work, and I believe it will work for you as well.  
However, this method has a drawback: it clears your interface and reloads it, which is not user-friendly. And I hope you can let me know the results of your try. Thank you.

---

<div class="post-metadata">

**Author:** ![tbs-tim](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/tbs-tim/32/34255_2.png) [@tbs-tim](https://community.cesium.com/u/tbs-tim)\
**Post date:** [June 30, 2026, 2:45pm UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/7 "2026-06-30T14:45:19Z")

</div>

A fix would be awesome as this heavily affects our production app and affects the user experience.

---

<div class="post-metadata">

**Author:** ![proj3d](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/proj3d/32/28173_2.png) [@proj3d](https://community.cesium.com/u/proj3d)\
**Post date:** [July 4, 2026, 1:04pm UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/8 "2026-07-04T13:04:36Z")

</div>

A fix would also be great for us, as RecreateTileset is not an option given the impact on user experience. We are experiencing “holes” in the 3D Tiles block display after viewing large areas, most likely due to a memory runaway on models that are easily handled by the Windows, Android, and iOS versions.

---

<div class="post-metadata">

**Author:** ![yuzhe](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/yuzhe/32/28173_2.png) [@yuzhe](https://community.cesium.com/u/yuzhe)\
**Post date:** [July 6, 2026, 2:13am UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/9 "2026-07-06T02:13:51Z")

</div>

@Cory_Barr It seems many people have encountered issues with WebGL memory. What progress has been made on this issue?

---

<div class="post-metadata">

**Author:** ![Cory\_Barr](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/cory_barr/32/14491_2.png) [@Cory\_Barr](https://community.cesium.com/u/Cory_Barr)\
**Post date:** [July 8, 2026, 7:04pm UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/10 "2026-07-08T19:04:59Z")

</div>

Hi @yuzhe

You’re right. We’re hearing reports of WebGL memory issues from various sources. We have some time in July planned to take a look at the various WebGL memory reports and see what can be done on our end. I’ll make a note to update this thread with any findings. Thanks!

---

<div class="post-metadata">

**Author:** ![proj3d](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/proj3d/32/28173_2.png) [@proj3d](https://community.cesium.com/u/proj3d)\
**Post date:** [July 22, 2026, 7:11am UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/11 "2026-07-22T07:11:40Z")

</div>

Here is Claude’s observation regarding this issue:  
On a multithreaded Cesium for Unity WebGL build, performance.memory.usedJSHeapSize (main-thread-only) drastically undercounts actual memory — in one test it read ~0.3 GB while performance.measureUserAgentSpecificMemory() (which includes Worker threads) read ~2 GB for the same moment. This confirms the growth is happening in the Worker thread(s) doing the actual tile/engine work, not the main thread — so any diagnostic relying on performance.memory alone will badly underreport the problem.

RecreateTileset() helps but doesn’t fully reclaim: it’s the documented mitigation, but it re-downloads all visible tiles (its own temporary spike) and empirically doesn’t bring memory back to baseline — suggesting something is retained independently of the tileset object lifecycle.

Separately: the wasm linear memory itself is expected to never shrink once grown (memory.grow is one-directional per the WebAssembly spec) — that’s a real ceiling worth designing around, but it’s a different issue from the JS-heap growth above and shouldn’t be conflated with it in the fix.

It also has a suspected root cause, but it’s most likely just quoting the forum threads.: CachingAssetAccessor — cesium-native’s SQLite-backed HTTP response cache. It’s redundant in a browser (the browser already caches HTTP responses) but, unlike the tileset itself, isn’t tied to RecreateTileset()'s lifecycle — so it would keep accumulating regardless of how often tilesets are recreated. Worth confirming whether this is compiled into WebGL/Emscripten builds, and whether excluding it under **EMSCRIPTEN** changes the growth curve.

---

<div class="post-metadata">

**Author:** ![yuzhe](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/yuzhe/32/28173_2.png) [@yuzhe](https://community.cesium.com/u/yuzhe)\
**Post date:** [August 3, 2026, 2:50am UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/12 "2026-08-03T02:50:33Z")

</div>

hi, @Cory_Barr i want to know have new progress in memory issue?

---

<div class="post-metadata">

**Author:** ![yuzhe](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/yuzhe/32/28173_2.png) [@yuzhe](https://community.cesium.com/u/yuzhe)\
**Post date:** [August 19, 2026, 4:59am UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/13 "2026-08-19T04:59:19Z")

</div>

It seems like some time has passed, and I want to know have any progress on this issue? I also welcome more people to join the discussion.

---

<div class="post-metadata">

**Author:** ![proj3d](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/proj3d/32/28173_2.png) [@proj3d](https://community.cesium.com/u/proj3d)\
**Post date:** [August 21, 2026, 5:41pm UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/14 "2026-08-21T17:41:51Z")

</div>

Hi,  
We are also waiting for a solution to this issue, as the memory runaway prevents production use of the WebGL build.

---

<div class="post-metadata">

**Author:** ![joeyyyyyy](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@joeyyyyyy](https://community.cesium.com/u/joeyyyyyy)\
**Post date:** [August 23, 2026, 12:25pm UTC](https://community.cesium.com/t/unity-webgl-out-of-memory/46421/15 "2026-08-23T12:25:00Z")

</div>

We’re also affected by this, excessive memory consumption in the WebGL build makes it unusable for us.
