Hi guys, I’m loving this new memory profiler - it’s been very helpful so far!
While profiling, I came across some math that doesn’t seem to add up, so I was hoping for some explanation as to what’s going on.
I have a small class that’s used for some rudimentary data operations:
public class SlotData
{
public byte flags = 0;
public byte index = 0;
public float number = 0.0f;
}
By my calculations, each instance of this class should take up 6 bytes, or conceivably 8 bytes due to some memory alignment issue.
However, the Memory Profiler shows me that an instance of this class takes up 24 bytes (see attached screenshot)! I’m trying to figure out why the overall “Owned Size” is 18 bytes more than what I’d expect the size to be.
Beyond this particular instance, I’ve also seen other situations where the “Owned Size” does not match the sum of the internal values. For example, another class shows as 64 bytes, but the sum of contained variables is 34 bytes.
Is this expected and I’m overlooking/missing something, or is this a bug?