Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

WebGL loading bundles memory leak on chrome

Discussion in 'WebGL' started by MatL, Sep 3, 2015.

  1. MatL

    MatL

    Joined:
    Jan 29, 2014
    Posts:
    18
    When the game finishes loading 8 bundles of 600KB aprox chrome stars increasing the memory until it crashes, it reaches 3GB
    This happens always for chrome on windows 8 and 10, on windows 7 happens only when chrome i set to incognito mode
    Some users are reporting the same on firefox but i could not reproduce it there.
    I am using Unity 5.2.0f3 but happens also with 5.1.3f1
    Any idea what could be the problem? i need to fix this!
    Thanks
     
  2. MatL

    MatL

    Joined:
    Jan 29, 2014
    Posts:
    18
    Sorry i was mistaken on 5.1.3.f1 is not happening is only happening on beta 5.2.0f3 so I can use the stable version, i will check back this when the beta is released.
     
  3. MatL

    MatL

    Joined:
    Jan 29, 2014
    Posts:
    18
    Ok 5.2.0f3 was releases, and this is still happening.
     
  4. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    There is actually a spike in Chrome memory consumption while loading the webgl page, however, by the time you start loading the asset bundles the memory usage should drop and not cause the crash. Though this is Chrome-specific, have you observed Firefox using 3GBs as well ?
     
  5. MatL

    MatL

    Joined:
    Jan 29, 2014
    Posts:
    18
    yuliyF likes this.
  6. kripken

    kripken

    Joined:
    Sep 16, 2015
    Posts:
    3
  7. MatL

    MatL

    Joined:
    Jan 29, 2014
    Posts:
    18
    It looks pretty similar thanks, that testcase increases the memory much faster than my demo and happens also on windows 7,I am going to comment there.
     
  8. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    I also ran into this issue while trying to create a WebGL version of a game I wanted to upload on newgrounds.com. I uploaded the game with several changes multiple times in one day and never had problems until I suddenly had the same problem, and I was not able to single out the issue by investigating / reversing the changes of the prior builds.

    I tried to reinstall chrome as this is mentioned as a possible fix in the google code thread linked above, but no luck.

    However the issue went away for me after I completely cleared the browser data via chrome://settings/clearBrowserData
    (I did not remove all browser data during the reinstallation of chrome as I wanted to keep my bookmarks etc.)

    I tried to reproduce the error with various player settings I suspected that might cause the error, but so far I was not able to reproduce it anymore, the game is running fine now. I'm happy that I can continue developing now, but I would prefer to have the issue identified and fixed because I'm worried it might show up for some of the players once the game is published. :-/
     
  9. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    Quick update on the high memory consumption problem when downloading asset bundles via WWW.LoadFromCacheOrDownload: We will ship a workaround in 5.3, which will also be available in a 5.2 patch in the coming weeks.
     
    sirrus likes this.
  10. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    Would this be the same issue that causes this exception for our webgl version? From the stacktrace I think it's a memory issue when loading assetbundles:

    An error occured running the Unity content on this page. See your browser's JavaScript console for more info. The error was:
    uncaught exception: abort() at jsStackTrace@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:1197:13
    stackTrace@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:1214:22
    abort@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:5448439:44
    _abort@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:8787:7
    _malloc@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:5392687:9
    __ZN13MemoryManager16LowLevelAllocateEj [MemoryManager::LowLevelAllocate(unsigned int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:601610:8
    __ZN17LowLevelAllocator6MallocEj [LowLevelAllocator::Malloc(unsigned int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:604986:8
    __ZN21UnityDefaultAllocatorI17LowLevelAllocatorE8AllocateEji [Allocate? UnityDefaultAllocator<LowLevelAllocator?>(unsigned int, int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:603128:8
    __ZN13MemoryManager8AllocateEjiRK10MemLabelIdiPKci [MemoryManager::Allocate(unsigned int, int, int&, char*, int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:600823:10
    __ZN13MemoryManager10ReallocateEPvjiRK10MemLabelIdiPKci [MemoryManager::Reallocate(void*, unsigned int, int, int&, char*, int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:600902:9
    __Z16realloc_internalPvjiRK10MemLabelIdiPKci [realloc_internal(void*, unsigned int, int, int&, char*, int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:600881:8
    __ZN15SerializeTraitsI13dynamic_arrayINSt3__14pairIi12ImmediatePtrIN5Unity9ComponentEEEELj4EEE19ResizeSTLStyleArrayERS8_iRK10MemLabelId [unsigned short* SerializeTraits<unsigned short, signed char dynamic_array<??_?>?e?>?r()]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:2308040:12
    __ZN18StreamedBinaryReadILb0EE21TransferSTLStyleArrayI13dynamic_arrayINSt3__14pairIi12ImmediatePtrIN5Unity9ComponentEEEELj4EEEEvRT_17TransferMetaFlags [T?r? StreamedBinaryRead<0, undefined?2?>?n(signed char)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:1636350:3
    __ZN5Unity10GameObject8TransferI18StreamedBinaryReadILb0EEEEvRT_ [undefined Unity::GameObject::Transfer<void, undefined?T?&, undefined StreamedBinaryRead<0>?_?>()]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:610430:3
    __ZN5Unity10GameObject23VirtualRedirectTransferER18StreamedBinaryReadILb0EE [Unity::GameObject::VirtualRedirectTransfer(undefined StreamedBinaryRead<0>?&)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:614291:2
    __ZN14SerializedFile10ReadObjectEx18ObjectCreationModebPPK8TypeTreePbR6Object [SerializedFile::ReadObject?1(long long)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:918829:5
    __ZN17PersistentManager18ReadObjectThreadedEi [PersistentManager::ReadObjectThreaded(int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:913381:2
    __ZN17PersistentManager40LoadRemainingPreallocatedObjectsInternalEv [PersistentManager::LoadRemainingPreallocatedObjectsInternal()]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:912955:5
    __ZN17PersistentManager10ReadObjectEi17AwakeFromLoadMode [PersistentManager::ReadObject?1(int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:913109:6
    __Z31ReadObjectFromPersistentManageri [ReadObjectFromPersistentManager(int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:606791:8
    __ZL25ProcessAssetBundleEntriesR11AssetBundleNSt3__14pairINS1_14__map_iteratorINS1_15__tree_iteratorINS1_12__value_typeI8UnityStrNS_9AssetInfoEEEPNS1_11__tree_nodeIS8_PvEEiEEEESE_EEP15ScriptingObjectRNS1_6vectorIP6ObjectNS1_9allocatorISK_EEEEb [ProcessAssetBundleEntries?S(AssetBundle?N?&)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:1733128:13
    __Z30LoadNamedObjectFromAssetBundleR11AssetBundleRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP15ScriptingObject [LoadNamedObjectFromAssetBundle?S(undefined?N?&&)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:836073:2
    __Z37AssetBundle_CUSTOM_LoadAsset_InternalP15ScriptingObjectP15ScriptingStringS0_ [AssetBundle_CUSTOM_LoadAsset_Internal?0(ScriptingString?S?**)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:994067:8
    _AssetBundle_LoadAsset_Internal_m22813@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:4831961:8
    _AssetBundle_LoadAsset_m19286@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:4831831:10
    _AssetBundle_LoadAsset_TisObject_t_m19775_gshared@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:4974828:9
    _U3CLoadBaseIdU3Ec__Iterator74_MoveNext_m5365@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:3333491:11
    __Z28RuntimeInvoker_Boolean_t3576PK10MethodInfoPvPS2_ [RuntimeInvoker_Boolean_t3576?2(void**, undefined?S?*)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:5267844:8
    dynCall_iiii@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:5441036:10
    invoke_iiii@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:17544:12
    __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP12Il2CppObject [il2cpp::vm::Runtime::Invoke?5(void**, undefined?S?*)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:91538:9
    _il2cpp_runtime_invoke@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:33757:8
    __Z20il2cpp_invoke_method21ScriptingMethodIl2CppP15ScriptingObjectP18ScriptingArgumentsPP18ScriptingExceptionb [il2cpp_invoke_method?2()]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:757536:9
    __ZN19ScriptingInvocation6InvokeEPP18ScriptingExceptionb [ScriptingInvocation::Invoke(bool**)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:881894:9
    __ZN19ScriptingInvocation6InvokeIbEET_PP18ScriptingExceptionb [undefined ScriptingInvocation::Invoke<bool>?T()]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:881833:8
    __ZN9Coroutine3RunEv [Coroutine::Run()]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:872220:9
    __ZN9Coroutine3RunEv [Coroutine::Run()]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:872255:3
    __ZN9Coroutine17ContinueCoroutineEP6ObjectPv [Coroutine::ContinueCoroutine(void**)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:872168:3
    __ZN12WWWDelayCall8CallbackEP6ObjectPv [WWWDelayCall::Callback(void**)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:692386:2
    __ZN18DelayedCallManager6UpdateEi [DelayedCallManager::Update(int)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:734838:10
    __Z10PlayerLoopbbP10IHookEvent [PlayerLoop(bool, bool, IHookEvent?*)]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:854229:3
    __ZL8MainLoopv [MainLoop()]@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:1947721:3
    dynCall_v@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:5440840:3
    Runtime.dynCall@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:314:14
    Browser_mainLoop_runner/<@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:9638:13
    Browser.mainLoop.runIter@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:11182:13
    Browser_mainLoop_runner@http://www.kweetet.dev/unity/webgl/Release/kweetet-webgl.js:9634:9
     
  11. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,633
    No. You are indeed running out of memory when loading assets from an AssetBundle, but this is different from the problem discusses, where the browser runs out of memory trying to cache assets in the IndexedDB. In your case you are running out of memory in the Unity heap - could you just try allocating more to that (in the WebGL PlayerSettings)?
     
  12. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    Indeed, the size was too low in the player settings. I've increased that, but it still crashes before the game is fully loaded (but with another error). The memory size of firefox climbs to 3GB and then it crashes. I found that avoiding downloading assetbundles helps (we get a bit further in the loading sequence) so I guess that would be the problem at hand?
     
  13. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    I just noticed, with the 64bit developer edition of firefox it doesn't crash, but the memory keeps increasing till over 8GB...
     
  14. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    do you use WWW.LoadFromCacheOrDownload ? Do you have a link you can share ?
     
  15. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,633
    1. How big are all your AssetBundles combined? Naturally, you won't be able to keep loading more and more AssetBundles without eventually running out of memory.

    2. Are you unloading bundles (AssetBundle.Unload) when you don't need them any more?

    3. Unity 5.3 supports LZ4 compression of AssetBundles in memory, which keeps the AssetBundle compressed in memory and will only decompress it when loaded, which might help with this situation.
     
  16. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    Thanks for your replies.

    I indeed use LoadFromCacheOrDownload. I'm working to get a version online, I'll report back when that's done.

    All assetbundles combined are over 1GB but of course I don't download them all. There are about 20 ab's downloaded at startup for about 80MB, give or take. But the game already crashes at 9 assetbundles, representing about 15MB.
    I allocate now 512MB and we should be under that limit with the resources we load. But I'm looking for ways to be absolutely sure and to have a good idea where the memory is going to, because at this moment I have no idea. The memory usage for the webplayer platform is ok though.

    I indeed unload immediately; I instantiate prefabs from the bundles and then unload them. I've found that doing that aggressively made it possible to crash later.

    But maybe my issues have other causes. I'm trying to pinpoint causes.
     
  17. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    I made some progress that I wanted to report. I'm not ready to provide a link because I still am adding many optimizations.

    I am now capable to get the first scene of my game up and running, but once it was fully loaded the memory of the firefox process soared to a whopping 10GB (it wanted to climb higher but it crashes by then). I use the latest 64bit developer build of firefox, to allow for larger memory.

    This entry from Jonas in the manual tipped me to the "solution", although it's not a real one: If I replace this line in my asset bundle manager:
    Code (csharp):
    1. WWW www = WWW.LoadFromCacheOrDownload(fullurl, abRef.Version);
    to
    Code (csharp):
    1. WWW www = new WWW(fullurl);
    then the memory stays happily at 350mb and doesn't climb at all.

    So if I load the data in the unity heap, all is fine, but if I try to cache the assetbundles something is seriously wrong.

    I can work on with this temporary fix, but I'd like to use the cache again in the future.
     
  18. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    yes...so the reason i was asking whether you use WWW.LoadFromCacheOrDownload is that there is currently an issue with that, which causes high memory consumption. A workaround will be included in 5.3 as well as in 5.2.3 Patch 1 (which should be released next week). Here is the issue tracker.
    You can use WWW(...) for the time being.
     
    Ryan.Alcock likes this.
  19. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Getting a bit anxious on this patch since this issue is a big deal for us. Is there any news on when it will be released (last week has come and gone)?

    Thanks!
     
  20. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    It's been delayed to this week.
     
  21. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    OK, thanks. Looking forward to it!
     
  22. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    It took longer than expected but the 5.2.3p1 patch is finally here.
     
  23. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    Perfect, thanks! I can confirm that it's working now for me. Much faster load times FTW :)
     
  24. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Well, we have tested the patch in 5.2.3p1 and we are still getting crashes for some (lots of) players. We actually had to revert back to not using LoadFromCacheOrDownload so that players could load their assets w/o crashing in Chrome.

    It appears that at some point, the Chrome processes still seem to double in memory usage (from about 1.5GB to 3GB total).
     
  25. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,633
    Do you have a link for the content which is still crashing Chrome, so we can test it?
     
  26. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Im working on building that now. I will try to get it to you today.
     
  27. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Jonas,

    How can I send you the link confidentially? PM ?
     
  28. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,633
    Got the project. I'm not sure this is a leak, though. How big are the AssetBundles your are loading? A problem with using AssetBundle caching in WebGL is that the way emscripten implements a file system on top of IndexedDB by mirroring in memory. So the whole data which is cached will also be kept in memory, which can cause problems like you describe. I believe we need to investigate options to implement AssetBundle caching on WebGL differently (currently is is the same implementation as everywhere else, which just automatically works due to emscripten's file system on top of IndexedDB).

    In the meantime, one thing which may help is to switch to Unity 5.3, which keeps AssetBundles LZ4 compressed in the cache, so it will use less space.
     
  29. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Jonas,

    Thanks for investigating. The assetbundles range in size but rarely larger than 1MB.

    Is it safe to assume that something similar will occur in Firefox once indexedDB is enabled for 3rd party scripts (i.e iframe via v43)?

    This is a very asset heavy project and it is a bit frustrating to have caching disabled.

    We are in the process of evaluating 5.3 now and are hoping for a migration before the end of the year but if data is basically mirrored in memory via emscripten, Im not optimistic that it will fix most cases of this.
     
  30. Coder1983

    Coder1983

    Joined:
    Oct 24, 2015
    Posts:
    8
    I am also facing the same issue with 5.3. If I try to have a download screen to cache, the "out of memory" error occurs before the main menu can start. If I remove the download screen and try loading as necessary. Then I get the error after few levels are played. I tried Profiler.enabled =true and constantly debugged the used memory size and found it to be growing. In editor its not growing. Unload of asset bundle is there. I tried getting profile from chrome which was showing 500+ MB.
     
  31. xpander

    xpander

    Joined:
    Oct 1, 2012
    Posts:
    26
    The issue still exists in Chrome in Incognito mode (tested on 5.3.4f1 and 5.3.4p3).
    When we use LoadFromCacheOrDownload(url) bundle size gets doubled in RAM compared to new WWW(url).
    It looks like Chrome stores IndexedDB in-memory instead of disk cache for incognito tabs.
     
  32. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    So I finally got around to testing this (Unity 5.5.1, LZ4 bundles, and latest versions of all browsers) and honestly it seems the same as always.

    Even when using UnityWebRequest (same behavior as LoadFromCacheOrDownload), using cached bundles consumes significantly more memory than not caching (in our case can be few hundred megabytes more). And eventually after caching enough bundles the application will crash (runs out of memory on the unity heap; obviously I could always allocate more but I'd pick less memory over caching atm).

    So unfortunately caching bundles on webgl is still not feasible for us. Our bundles I think are fairly typical in size (at most a couple megabytes, usually less than a megabyte). However we do probably load 50-60 megabytes worth of asset bundles total depending on the application (we load them one at a time though). We also keep a few asset bundles loaded during the entirety of the application (we emulate "Resources folders" with them), but normally (uncached) this is not an issue. Is there anything I'm missing/should be doing more optimally?
     
  33. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    how does it crash? does it run out of memory inside the Unity Heap or does it run out of browser memory?

    A memory efficient way to cache asset bundles is to use the CachedXMLHttpRequest package,
    as described in this blog post.
     
  34. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    It runs out of memory on the Unity heap while loading an asset bundle. I can increase the size of the heap and "put off" the problem but if you cache enough bundles it will eventually gulf the heap. You can view it happening in "real time" with the task manager: the process will slowly grow memory as more unique bundles are cached whereas without caching the memory is essentially always stable. I also had it set to enable caching only for 64-bit browsers so I don't think the browser was running out of memory (and QA was able to reproduce the crash on 64-bit Firefox, 64-bit Chrome, and 64-bit Edge).

    I'll admit we are a bit of a "worst case" for this situation. We have one webgl binary/build in one location (domain) for all of our webgl "applications" (we just feed the binary different configuration files and asset bundles). So honestly if a user just played one application (or we had one application per domain), we could probably stomach the extra memory for caching. Where this really becomes a problem for us is when a user plays multiple "applications", that's when the increased memory really starts exploding.

    I'll try the asset store package though and see if I can make it work with our pipeline. Thanks for the suggestion!
     
  35. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    So we're going to do a larger roll out next week, but the CachedXMLHttpRequest package seems to work without using extra memory! We're even going to try using it on 32-bit browsers! And caching of the binary also seems to work!

    Thanks a lot @Marco-Trivellato! You guys should try integrating this somehow with WWW/UnityWebRequest. It seems quite promising.
     
  36. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Just putting my 2 cents in on this as well.

    We were able to update to v5.3.7p3 (which seemed to solve some previously encountered audio bugs) and are now utilizing the CachedXMLHttpRequest package. Major improvement in both memory spikes and assetbundle load times (obviously due to caching)! Great work and thanks!
     
  37. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    As a follow-up, our console logs are still flooded with "starting www download" and "loading from cache", even when CachedXMLHttpRequestSilent is set to true.

    Is there any way to disable these log statements?
     
  38. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    Are you still using LoadFromCacheOrDownload ?
     
  39. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Yes. I thought these log statements were from the CachedXMLHttpRequest plugin but apparently these are specifically pushed out when using LoadFromCacheOrDownload?
     
  40. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    The idea of CachedXMLHttpRequestSilent is that you get caching at the http level, not in Unity. So, you should use WWW ctor instead of LoadFromCacheOrDownload.
     
  41. sirrus

    sirrus

    Joined:
    Jun 10, 2012
    Posts:
    250
    Wow, my mistake. I assumed the CachedXMLHttpRequest plugin would override the LoadFromCacheOrDownload calls if enabled. OK. Back to the test lab... thanks!
     
  42. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    I can confirm setting CachedXMLHttpRequestSilent to true works for us using UnityWebRequest (with Unity's builtin caching disabled).

    Honestly the only "gotcha" is etags aren't cross-domain compatible by default, but that can fixed with a server change. I think our server guys also said it increased the server load by a hair, but not in a meaningful way.
     
  43. Rbhaniwal

    Rbhaniwal

    Joined:
    Jan 23, 2015
    Posts:
    33
    Hello @jonas-echterhoff

    I made an assetbundle file for unity WebGL. Everything is working with unity editor but when i lunched product on browser my progress bar is stuck on 0% and nothing will be downloaded.
    Attched screenshots are of editor and webgl respectively. Please check and help me out.

    Thanks in advance.
     

    Attached Files:

  44. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    this does not seem to be related to memory. I suggest you open a new thread.
     
  45. ypoeymirou

    ypoeymirou

    Joined:
    Jul 31, 2015
    Posts:
    54
    Hi,

    I am sorry but this discussion is confusing to me.
    At the end, when loading Asset Bundles from WebGL, what is the correct approach ? Right now I am using WWW.LoadFromCacheOrDownload(assetBundleURL, assetBundleVersion), should I change it ?

    If yes, is there a documentation about it ?

    Thanks,

    Yvan
     
  46. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    WWW.LoadFromCacheOrDownload works fine, it just uses more memory than you would expect. More details in this blog post.
    If you are not tight on memory, then I would not worry about it.
     
  47. ypoeymirou

    ypoeymirou

    Joined:
    Jul 31, 2015
    Posts:
    54
    Thank you !
     
  48. MFKJ

    MFKJ

    Joined:
    May 13, 2015
    Posts:
    226
    Hi guys, it 2019 and i am using unity 2018.3.8

    I have a weird issue when i am loading (refreshing) my webgl page again and again the memory head snapshot (of a an empty project) producing these memory result in chrome and then crash:
    1.2MB (first load)
    1281 MB (2nd reload)
    1574MB (3rd reload)
    2160MB (4th reload)
    then, crash and Aw Snap error in chrome. If i understand it correctly each page load(refresh) taking the memory. why it is happening?


    The second thing is that i want to ask how to use CachedXMLHttpRequest? do it automatically take over UnityWebRequest ?
     
  49. unity_007fkj

    unity_007fkj

    Joined:
    Mar 23, 2019
    Posts:
    2
    Hope you are all doing well, i have a project on unity 2018.3.8 and the problem is that whenever i try to refresh/reload the same webgl page, the memory increment significantly. I have asked this question on different webgl forum threads on unity but still unable to get an answer.
    Why reloading the webgl page consume memory again and again then crash?
     
  50. unity_007fkj

    unity_007fkj

    Joined:
    Mar 23, 2019
    Posts:
    2
    Hi folks
    Need your help.

    My memory incrementing with each page refresh.

    Like if i load a webgl first time it will show 600 mb then if i hit refresh it show memory around 1000 or 1200 mb. Then each refresh double the memory. Now if i close the tab and start again then the memory remain same.

    I have generated the build with unity 2018.3.8 and data caching feature is enable.

    Please help.
     
unityunity