Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Understanding memory profiler: System.Byte[] ?

Discussion in 'Profiler Previews' started by Jelmer123, Mar 15, 2021.

  1. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    245
    Hi

    I've got a relatively large System.Byte[] section in the memory profiler result. It is 230MB, approx 50% of all memory used by my app.
    How can one find out what it is?
     
    c_koenig likes this.
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,517
    Looking at the content byte by byte is likely going to be tough to parse. It still being in memory means there's a likely chance something still holds a reference to it. If that's the case the Ref Count column should hold a blue number. Clicking on that would show you a list of Objects that reference it (each with a Ref Count of their own). Following that trail is likely to be your best chance of figuring out what's up with that byte array.

    You could also search your codebase for
    byte[
    or similar but it might be a return value stored in a var, so... that might lead nowhere.
     
  3. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,637
    Interesting, I have 5541 of these taking up 4.74gig of ram. I cant work out how to track objects that use these arrays, I just see managed fields, with a list of arrays, I do see referenced by but it all seems to be related to the memory profiler itself. Also theres many many references in some cases 75k (is that using more memory needlessly?), just wondering how I track this down given that it doesnt seem to show me the objects using/creating them. I dont see any blue numbers.
     
    SparkesRS and c_koenig like this.