Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Understanding memory profiler: System.Byte[] ?

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

  1. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    226
    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,098
    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,577
    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.
     
    c_koenig likes this.