Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    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:
    243
    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,453
    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,633
    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.