Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

iOS 12 large memory usage

Discussion in 'iOS and tvOS' started by johnfrog, Sep 20, 2018.

Thread Status:
Not open for further replies.
  1. QualityJohn_TT

    QualityJohn_TT

    Joined:
    Jan 26, 2018
    Posts:
    2
    Also having problems with our game using Unity 2018.2.16f1. App uses 420Mb to load into the first scene on iOS 11 and over 900Mb on devices running iOS12.

    This isn't just a difference in the memory reporting, all the 1Gb devices (iPad Air and iPhone 5s) running iOS 12 will force close due to memory limits whereas the same devices on iOS 11 will run the game without issue.

    Code (CSharp):
    1. iOS 11:
    2. Used Total: 351.4 MB   Unity: 95.1 MB   Mono: 7.8 MB   GfxDriver: 254.1 MB   FMOD: 11.9 MB   Video: 0 B   Profiler: 2.1 MB  
    3. Reserved Total: 359.0 MB   Unity: 102.7 MB   Mono: 11.3 MB   GfxDriver: 254.1 MB   FMOD: 11.9 MB   Video: 0 B   Profiler: 2.1 MB  
    4. Total System Memory Usage: 0 B  
    5.  
    6. Textures: 354 / 215.5 MB
    7. Meshes: 196 / 45.1 MB
    8. Materials: 608 / 1.5 MB
    9. AnimationClips: 102 / 3.2 MB
    10. AudioClips: 71 / 10.5 MB
    11. Assets: 4615
    12. GameObjects in Scene: 2366
    13. Total Objects in Scene: 9894
    14. Total Object Count: 14509
    15. GC Allocations per Frame: 39 / 2.0 KB

    Code (CSharp):
    1. iOS 12
    2. Used Total: 0.94 GB   Unity: 96.0 MB   Mono: 8.6 MB   GfxDriver: 0.85 GB   FMOD: 11.9 MB   Video: 0 B   Profiler: 2.1 MB  
    3. Reserved Total: 0.95 GB   Unity: 103.6 MB   Mono: 11.2 MB   GfxDriver: 0.85 GB   FMOD: 11.9 MB   Video: 0 B   Profiler: 2.1 MB  
    4. Total System Memory Usage: 0 B  
    5.  
    6. Textures: 484 / 0.83 GB
    7. Meshes: 197 / 45.1 MB
    8. Materials: 611 / 1.5 MB
    9. AnimationClips: 102 / 3.2 MB
    10. AudioClips: 71 / 10.5 MB
    11. Assets: 4618
    12. GameObjects in Scene: 2367
    13. Total Objects in Scene: 10034
    14. Total Object Count: 14652
    15. GC Allocations per Frame: 45 / 2.0 KB
     
    MoribitoMT and hungrybelome like this.
  2. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,987
    Hopefully Unity/Apple will do something about it.
     
  3. jcarpay

    jcarpay

    Joined:
    Aug 15, 2008
    Posts:
    513
    Sofar they are pretty much in denial..
     
  4. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,987
    Yeah :(
     
  5. johnfrog

    johnfrog

    Joined:
    May 7, 2015
    Posts:
    9
    I honestly don't know what XCodes memory profiler is doing - but somehow I can spam
    Code (CSharp):
    1. Marshal.AllocHGlobal(1024* 1024* 40);
    and the profiler doesn't change. However you will certainly receive malloc errors on the device once it runs out of memory.
     
  6. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    395
    Still happening in Unity 2018.2.19f1. No response from Unity on my Bug Report Case 1104251.
     
  7. Jaynesh

    Jaynesh

    Joined:
    Feb 28, 2015
    Posts:
    32
    Unity's biggest advantage over Unreal was for Mobile. If unity continues to ignore this issue then, Unreal can very easily take over. Especially with the new Epic store too. Unity need to catch up.
     
    MoribitoMT, Regone and frozenpepper like this.
  8. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    121
    Wow, we get alot of negative reviews in the last time... and we can't really do anything about it. We need news on that!
     
    Regone likes this.
  9. Regone

    Regone

    Joined:
    Aug 1, 2014
    Posts:
    25
    Same issues here...

    Can't show any demos to potential partners and audience because of the app crashing mid demonstration due to memory issues

    This is so limiting and we are feeling pretty much helpless regarding this issue,
    Though we are trying to figure out ways to cut the memory usage without changing the way game looks and behaves too much but found no luck so far.

    We've Built and tested on:

    OSX 10.13.6 -
    iOS 12.0,12.1
    Xcode 10 Beta, 10.1
    Unity 2018.2.18f1, 2018.1.2f1

    and had no noticeable improvements

    P.S: We also tried to downgrade Xcode to 9.4 and copy Platform support files but couldn't find iOS 12+ as a valid target platform not matter what we did.
     
    hungrybelome and pixelsplit like this.
  10. frozenpepper

    frozenpepper

    Joined:
    Sep 17, 2007
    Posts:
    210
    Probably unrelated to the main issue being discussed here, but could help some.
    We found out (the hard and long way) that upgrading from Unity 2018.1.x to 2012.2.19f1 we had more than 3x the ram usage on IOS 12 and 2.5X on IOS 11, leading to obvious crashes.
    In our case the main issue was due to some sort of bug with asset compression on Unity side, we had "Compress assets on import" disabled in the preferences, and while assets had already been compressed in 2018.1.x the newer version was instead ignoring the compression (on textures at least). Solution was to enable "Compress assets on import" and reimport all project (which wasn't fast), but now memory use is at least comparable to what we where used to.
     
  11. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,987
    Thanks frozenpepper, I'll give that a go.
     
    frozenpepper likes this.
  12. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,987
    I just looked and that option is already checked for me. However on thinking about this I had issues building for Windows Standalone a few days ago. It was claiming my texture compression was in an unsupported format. To fix it I deleted the library folder forcing Unity to reimport. I wonder if that's somewho related and also might of fixed the issue. I'll try it out today.
     
    frozenpepper likes this.
  13. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,987
    Just build for Android after building for PC and found my build jumped from 300mb previously to 1.8gb. Unity didn't compress any textures. Everyday there's always an issue with Unity.
     
  14. jtate5

    jtate5

    Joined:
    Jan 13, 2014
    Posts:
    14
    Following this thread. We basically have not been able to test our game on iOS 12 due to constant out of memory crashes.
     
  15. frozenpepper

    frozenpepper

    Joined:
    Sep 17, 2007
    Posts:
    210
    Texture compression seems to be having some major issues in this latest version. Based on what you wrote I think you will have to force once more compression after having switched platform to Android (from what I got you reimported everything after having deleted the library but while editor was set on "Windows Standalone", so I guess unity compressed assets only for that platform).
    For me, having "compress assets on import" and pressing "reimport" (right mouse button on the library panel) fixed the issue without having to delete the library. Have experienced the exact same problem switching from iOs to Android, with a huge build, impressive memory use and having to go through 6 hours of reimporting everything.... (reimporting everything on another project as I'm writing this)


    [RANT/] ................... past few years have been terrible especially for mobile platforms. Still have some projects that I have to build with Unity 4.7.2 as was never able to port them or get them to perform decently with newer Unity versions on iOs..... Add to this that each new update brings tons of new bugs and quirks while leaving older ones unsolved.... Most definitely not happy with last years of Unity "evolution" and what appears as a loss of interest for mobile development on their side (or at the very least a very serious separation from their roadmap and what they can actually deliver). [/RANT]
     
  16. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,987
    I did have to reimport and rebuild on android. I've switched over to iOS now and surprise suprise, I need to reimport all again as I'm seeing a lot of (not yet compressed) on my textures.
     
    Regone likes this.
  17. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    395
    I had the project upgraded to 2018.2.19f1 (latest before 2018.3) and builds were working on Windows (barely, despite my absolute monster PC— playing with jutter when using DX12, still in 'Experimental' mode, and not at all in DX11 for god knows why) but...

    Just tried to open the project & upgrade it into Unity 2018.3 today and it can't even complete this process, crashing out when trying to reimport all the assets.

    So now, if you want to stay current and avoid code rot (which at this point is a weekly issue), Unity doesn't even work at all. Great. (Of course, at least for us.)

    I have been thinking about just switching over to Unreal finally, especially now that there's the Epic Games Store. I've been with Unity Pro since 2011, at this point paying around $10,000+ for annual licenses and I'm thinking... for what? This is where we are now in the glorious future? Unity can't even open a project it could open last week, on top of being incapable of building to an officially supported major target iOS/tvOS?

    Come. On.
     
    Last edited: Dec 13, 2018
    MoribitoMT and yanivng like this.
  18. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,987
    Yeah this is my feeling too lately. Epic seems to be making Unreal look very tempting indeed. Unity just seems to be getting less reliable as time goes on.
     
  19. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    395


    Hmmm... it's a race. Who will win?
     
    Regone and derkoi like this.
  20. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,987
    Unreal?

    Been watching some UE4 tutorials and it looks good to me, you can tell it was made to make a game, if you know what I mean.
     
    Xander-Davis likes this.
  21. Jaynesh

    Jaynesh

    Joined:
    Feb 28, 2015
    Posts:
    32
    What is the initial memory usage in unreal engine for a blank project vs unity?
     
  22. Jaynesh

    Jaynesh

    Joined:
    Feb 28, 2015
    Posts:
    32
    hungrybelome, Regone and Xander-Davis like this.
  23. ScottF

    ScottF

    Director of Development, Mobile Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    82
    Thanks for the specific feedback, we are looking into this right now.

    We have shared this project with Apple. In addition it could be impacted by the potential issue above. Will report back if we discover a specific regression in 2019.2.
     
  24. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    395
    Finally got the project upgraded to Unity 2018.3. No errors, successful and effective builds on macOS and Windows. Memory bug is still happening on tvOS, which at this point is expected. One can hope...
     
    Lars-Steenhoff and Regone like this.
  25. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    227
    I feel relieved to have finally found this thread. In XCode the memory profiler shows around double what the Unity profiler shows. My game keeps crashing on iOS 12 and I spent more than a day dedicated to trying to isolate what was causing the memory issues. Real bummer about this.

    When I look at the expanded stats in the Unity profiler, they look accurate in terms of the compressed texture size, mesh size and number of objects. The sizes match what the editor inspector states when inspecting the individual compressed textures and meshes.

    Tried on:
    XCode 10.1
    iPhone 7 on iOS 12.1.1, 12.1.2
    Unity 2018.2.14f, 2018.2.20f1, 2018.3.0f2



     
    Last edited: Dec 22, 2018
  26. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    227
    Did you ever find a solution by chance? I'm stuck in the same way. Trying to get a demo out asap.
     
  27. Jaynesh

    Jaynesh

    Joined:
    Feb 28, 2015
    Posts:
    32
    What's crazy is that Unity even knew about this issue before the release of iOS 12 and decided to keep it quiet.
     
    Regone likes this.
  28. Jaynesh

    Jaynesh

    Joined:
    Feb 28, 2015
    Posts:
    32
    @PauliusP @ScottF please investigate the compression of meshes. We have reason to believe that meshes aren't being compressed on iOS12.
     
    Xander-Davis likes this.
  29. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    362
    Could you provide some more information about this issue? Has it been reported in another thread or as a bug report? What are you seeing that leads you to that conclusion and how can we reproduce it? Thanks!
     
  30. mybuddyai

    mybuddyai

    Joined:
    Jul 4, 2017
    Posts:
    2
    Hi, Unity team!

    We experienced huge issues with 2018.2/3 updates on iOS12. It seems like 2018.1 works perfectly but after 2018.2 update our users experience freezes and crashes. Memory usage increases 3x times. The worst affected device is an iPhone6+. We spend two weeks on optimizations already, but it's not even close to 2018.1 version.

    We can provide any information you want to accelerate the Unity Engine update, that everybody is waiting there.
     
    Cookies_Games and hungrybelome like this.
  31. jParmentier

    jParmentier

    Joined:
    Dec 4, 2017
    Posts:
    1
    I want to report the same kind of behaviour that a lot of people are already reporting.
    Using metal, Xcode 10 report 120 mb of usage more on ios 12.1 than 11.
    I'm sure part of that is them being better at reporting memory. But we are being stopped for lack of memory on ios 12 and not on 11.

    iphone 5s on ios 11: 455 mb reported ( can load the next level )
    iphone 6p on ios 12: 620 mb reported ( killed by OS when loading the next level). (50 mb more for the increase size of renders targets.)
    iphone 6p on ios 12 with iphone 5s resolution: 570 mb reported, (killed by OS when loading the next level)

    (all of those results with 21018.2.0f2, but a quick test with 2018.3 doesn't seems to have any change )
     
  32. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    121
    Any update on this in 2019?...
     
    Regone, Xander-Davis and hungrybelome like this.
  33. Jaynesh

    Jaynesh

    Joined:
    Feb 28, 2015
    Posts:
    32
    @pixelsplit 2019? Unity is still stuck in the year 2014.
     
  34. Regone

    Regone

    Joined:
    Aug 1, 2014
    Posts:
    25
    Jaynesh 1
    Unity 0

    #TEAM_JAYNESH
     
    derkoi and Jaynesh like this.
  35. deverolirc

    deverolirc

    Joined:
    Jan 19, 2014
    Posts:
    301
    @PauliusP @ScottF @Masterfalcon

    Guys, could we please get some clarification on this? According to Paulius this has been a “known” issue since iOS 12 beta... and then according to Scott it’s not even an issue, when quite obviously it is certainly happening.
    Almost everyone on this forum is reporting the exact same thing, around 2-3x memory usage + crashing on newer devices running iOS 12, while not having any issues previously.

    Please could one of you clarify what is happening, or at least point us to some possible fixes/work arounds?
     
  36. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,518
    You need to send them more repro cases.
     
    Peter77 and Jaynesh like this.
  37. Jaynesh

    Jaynesh

    Joined:
    Feb 28, 2015
    Posts:
    32
    Expanding on what @deverolirc has said

    - According to Paulius this has been a known issue since iOS12 beta. (Why didn't you tell us?)
    - According to Scott it's not even an issue. (Which it is)
    + According to the issue tracker this issue has been fixed in the latest version of iOS 12.1 (which is not true).

    Have we missed any other opinions?
     
  38. deverolirc

    deverolirc

    Joined:
    Jan 19, 2014
    Posts:
    301
    Well 1, Paulius acknowledged it was a known issue that they were aware of, so it should not be assumed that they need more cases, even though many users have already submitted cases! 2, if they do need more cases, they should comment here saying something like "Hey, we are having trouble identifying the issue here, can anyone provide us with some more reproduction cases that we can analyze?

    This is huge problem for some people, really disappointed as this has been a known issue since June - August! That is 5-7 months and no solution, or anything at all besides a few misleading comments from clearly uncoordinated Unity employees!
     
  39. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,518
    What are you talking about? @ScottF specifically asked for repro projects in the previous page.
     
  40. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    395
    When you said "send them more repro cases" I thought that was sarcasm. Because it's been like OVER HALF A YEAR where they should have been able to not only run into this themselves by now but also completely debug it. And I'm sure people have sent them plenty of repro cases already, at least one, which should've been enough by itself. That usually is Unity's canned response, which always comes off as lazy and makes themselves look aloof to what's going on with their own engine.
     
    Last edited: Jan 4, 2019
    mybuddyai likes this.
  41. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,518
    It’s is my impression that Unity has accepted Apple’s explanation that “XCode is more accurate now”.

    The only way you can force both Unity and Apple (I’m really not sure who is at fault at this point), is to provide good repro cases to Unity, so they can either figure out the issue (if it’s their issue), or they can send them very concrete info to Apple about how it’s their fault.
     
  42. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    121
    @AcidArrow For us it is not a problem with XCode, but with the actual device memory management (maybe that got more accurate?). The app throws applicationDidReceiveMemoryWarning way earlier than it did before.
     
  43. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,518
    I understand and I believe you, I'm just saying a repro will help.
     
  44. frozenpepper

    frozenpepper

    Joined:
    Sep 17, 2007
    Posts:
    210
    Don't know if it is your case, but check build size and in particular texture compression in the final iOS build. We tend to use every mb of memory available on every device and while we found a huge issue with texture compression when upgrading our projects, once we isolated and fixes that, memory use is back to normal (pre Unity 2018.2 and iOs 12 levels). xCode got better at reporting real memory use and probably memory warnings are fired more consistently with the improved memory reporting, BUT, in our case at least, we crash with the exact same amount of resources (in test scenes made to test actual memory available) both on iOs 11 and iOs 12 and with Unity 2018.1 and Unity 2018.3.
     
    Xander-Davis likes this.
  45. Jaynesh

    Jaynesh

    Joined:
    Feb 28, 2015
    Posts:
    32
    No official statement on this from Unity in 2019. Unreal engine is looking like the future for many of us here.
     
    MoribitoMT and mybuddyai like this.
  46. udede

    udede

    Joined:
    Jul 26, 2011
    Posts:
    58
    Hello
    is there any progress on this?
     
    mybuddyai likes this.
  47. Regone

    Regone

    Joined:
    Aug 1, 2014
    Posts:
    25
    Guys, This issue screws me up big time.
    Im working in a company where other guy is in charge of android where everything works great and I'm happy for all of us but on the iOS where I'm in charge the game crashes randomly and I don't have any answers or solutions to offer.
    Everyone sees me as unprofessional liar who doesn't know his job....

    What I'm saying here may sound funny but this is the truth and this is nerve wracking :X
     
  48. fakegood

    fakegood

    Joined:
    Oct 11, 2013
    Posts:
    15
    Code (CSharp):
    1. string[] guids1 = AssetDatabase.FindAssets("t:texture");
    2.  
    3.         foreach (string guid1 in guids1)
    4.         {
    5.             string assetPath = AssetDatabase.GUIDToAssetPath(guid1);
    6.             Texture texture = (Texture)AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture));
    7.             if (texture != null)
    8.             {
    9.                 if (assetPath.ToLower().Contains(".otf") || assetPath.ToLower().Contains(".ttf") || assetPath.ToLower().Contains(".asset"))
    10.                     continue;
    11.  
    12.                 AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.Default);
    13.             }
    14.         }
    hello, so i just wrote an editor script to just reimport the textures.. to remove Not yet compressed error.

    however, i am not sure whether this will solve the memory doubling issues on iOS.
     
  49. Regone

    Regone

    Joined:
    Aug 1, 2014
    Posts:
    25
    Have anyone tested it so we could get some insight?
     
  50. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    1,987
    I've tried reimporting the textures manually & it makes no difference.
     
Thread Status:
Not open for further replies.