Search Unity

More memory questions. Wasm "dynamic" allocation or not until 2108.2 ?

Discussion in 'Web' started by fwalkerCirca, Jun 5, 2019.

  1. fwalkerCirca

    fwalkerCirca

    Joined:
    Apr 10, 2017
    Posts:
    57
    This document https://blogs.unity3d.com/2018/08/15/webassembly-is-here/ states that:
    "One of the limitations we had with asm.js was the restriction on the size of the Unity Heap: Its size had to be specified at build-time and could never change"
    Later it states:
    "Think of the Memory Size value as the initial size that your content starts with. This is a feature built in 2018.2, so you can take advantage of it today"

    Ok so that means that : If you are using asm and you allocated something low, like 32MB, you are likely going to get an out of memory exception. Got it.
    But what if you were using wasm prior to 2018.2? Would it be "dynamic" or would the application have the same behavior as asm?

    In other words, does the "dynamic" memory only work on wasm after 2018.2 ?

    And when doing a reallocation. Does it try to allocate another 32MB at a time?
     
  2. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    167
    As I know (tested and takes OOM) unity 5.6 - 2017 - 2018, prior to new experimental feature, was crash OOM whenever the app will request more memory total than you specified in the build settings.
    asm'js and wasm both - in unitty 5.6 - 2017 definitely (tested) crashes OOM too.
    I doesn't test new feature, but as I understrand, it must create new ArrayBuffer(newSize) and copy to it from old ArrayBuffer(initialSize) in JS.