Search Unity

Memory heap is increasing each time the page is reloaded

Discussion in 'WebGL' started by arisdev82, May 2, 2019.

  1. arisdev82

    arisdev82

    Joined:
    Feb 27, 2019
    Posts:
    21
    Hi.

    Each time the page is reloaded the memory heap increases. This happens till the browser dead.

    Any idea?
     
  2. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    669
    Why you re-loading the page anyway?
     
  3. arisdev82

    arisdev82

    Joined:
    Feb 27, 2019
    Posts:
    21
    We are using Unity inside a big framework to show 3D scenes and there are different iframes. Sometimes we need to reload all, I can't explain the specific reasson.

    Anyway, random tab crashes on loading is not the best.
     
  4. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    287
    Did you try to use Application.Quit inside Unity before reloading
    Or unityInstance.quit() from JavaScript?
     
  5. unity_fPHZtGC0l2r-sQ

    unity_fPHZtGC0l2r-sQ

    Joined:
    Feb 19, 2018
    Posts:
    23
    Please De-Panther, do you mind give instructions on how to do this? I'm not very experienced with javascript, this will help me a lot. Thanks
     
  6. arisdev82

    arisdev82

    Joined:
    Feb 27, 2019
    Posts:
    21
    Hi De-Panther.

    Yes, we are doing both things. The problem seems to be the debug console , if it is closed memory remains ok, memory increases just happens with the console open. Everytime we close the console memory is unloaded. Very weird.

    Another thing is the memory management on IOS, it is just a disaster but I think the problem here is the max allocation memory allowed with Webkit + memory fragmentation.

    unity_fPHZtGC0l2r-sQ, just check the unload events (window.addEventListener("beforeunload", BeforeUnload, false);) to force Unity call Application.Quit.

    You can also check if Quit is called with "unityInstance.Quit".

    unityInstance.Quit(function ()
    {
    console.log("Unloading done");

    unityInstance = null;
    }
    );