Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question WEBGL Memory limits

Discussion in 'Web' started by beatdesign, Mar 1, 2023.

  1. beatdesign


    Apr 3, 2015
    I read that WebGL has a 2GB Heap limit. What value should I track in my application in order to see if I'm reaching that limit?
    • Total reserved memory
    • System used memory
    • GC used memory
    • Total used memory
    • GetMonoUsedSize
    • GetMonoHeapSize
    Any suggestion?
  2. CodeSmile


    Apr 10, 2014
    That 2GB limit is imposed by the browser for each tab, and this includes memory for everything on that tab - cache, images, html, javascript, the unity app and so on. Don't expect to be able to use all of that!

    Depending on the target platform you will be having a hard time getting anywhere close to that, especially if you build for mobile you want to make sure memory usage is below 512 MB for the Unity app itself (maybe even altogether to be on the safe side, so don't embed in a complex webpage).

    There's also the issue of memory fragmentation as allocating more memory beyond the initial allocation requires that requested free memory to be contiguous. So you cannot rely on any allocation beyond the initial memory budget to succeed, thus it's best to stay well below that initially defined budget.

    Best practice is to use the Firefox profiler, as mentioned here:

    And you'll find the best memory debugging infos in here: