Why do value types show up in the memory profiler?


I am wondering why some of my value types (structs) are showing up in the ANTS memory profiler?

I was under the impression that the memory profiler only shows objects that are garbage collected, and value types shouldn't be, correct?



  • Bart ReadBart Read Posts: 997 Silver 1
    Hi Nick,

    I'd say that they've probably been boxed because they've been added to collections, or perhaps they're the values of member fields of classes types, whose instances are going to be on the heap. I think the former is probably more likely.

    Now, I've never looked at the memory profiler codebase, so I'm unsure how it deals with arrays of value types, and I've never been looking for them when tracking down a memory problem (I tend to filter out anything I'm not interested in using the column filters), but I seriously doubt the individual values would appear in the results.

    Hope that helps.


    Bart Read
    Principal Consultant
    bartread.com Ltd
  • I think I figured it out after reading your reply. I am storing the value type in a dictionary way down the line, so I am assuming this is where it comes from.

Sign In or Register to comment.