Search Unity

Profiler and System.ExecutableAndDlls memory

Discussion in 'iOS and tvOS' started by hutch_jl, May 12, 2014.

  1. hutch_jl

    hutch_jl

    Joined:
    Jan 8, 2013
    Posts:
    40
    Hi,

    Our game is reporting 129mb used for System.ExecutableAndDlls in the detailed memory profiler when running on iOS, which seems very high. Searching online people seem to say this number is a result of adding plugins, but our previous game which uses the exact same plugins (mono dependency list for both is the same) reports 84mb. In other places people say this number is nothing to worry about, but all the rest of Unity's memory excluding this figure according to the profiler amounts to 130mb, when Instruments reports real memory use of 261mb. If it's not the executable what is all the additional memory that Unity isn't reporting? If I build just an empty scene the System.ExecutableSizeAndDlls figure is the same, but runtime memory use in Instruments is ~45mb, which is also confusing.

    TL;DR - if the System.ExecutableAndDlls figure isn't real/important, where is the ~130mb difference between Unity's self-reported memory use and what Instruments shows? If it is real, why does it not result in 129mb used still when running an empty scene? Why do two apps with the same plugins use vastly different amounts of executable/dll memory?
     
  2. hutch_jl

    hutch_jl

    Joined:
    Jan 8, 2013
    Posts:
    40
    So after some painful investigation, I've found a prefab in our project which referenced other prefabs in serialized fields. If this prefab is referenced statically into a scene, even if made inactive, the game's memory use as measured on device by Instruments grows by 40mb, but Unity only owns up to 13mb of this in the detailed memory profiler. Why is this? If Unity maps this data into memory assuming that it won't be made dirty and can therefore be unpaged by the OS, this doesn't seem to occur in reality, as the resident memory size seems to be what causes our app to be terminated and what shows up in out-of-memory dump reports. If I remove this prefab from the game our peak memory use is 40mb lower and we no longer get terminated.

    If Unity at least displayed this memory use in some way it would be much easier to find the cause, rather than me having to AB test the whole project trying to track it down.
     
  3. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    902
    Did you ever find details about enormous memory usage of System.ExecutableAndDlls? Thanks for sharing anything you've found out.
     
  4. hutch_jl

    hutch_jl

    Joined:
    Jan 8, 2013
    Posts:
    40
    Hi,

    This was on a much older Unity version, we haven't had similar issues recently. Do be careful with referencing prefabs in serialized fields, we avoid this now as it seems to result in a larger memory footprint than using Resources.Load and instantiating off that.