Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
- Posts: 1
- Joined: Mon Mar 06, 2006 5:10 pm
I've created a simple class with no fields. If I view the details of an instance of this class then the size is: 12. Why?
- Posts: 1029
- Joined: Wed Mar 02, 2005 7:53 pm
Each instance that is allocated on the heap contains a 4-byte vtable pointer and a 4-byte syncblock index (which is used when the instance is used as a monitor). Additionally the runtime will not create instances that are smaller than 12 bytes, so instances of a class that contains a 4-byte field will not consume more memory than an instance of a class that doesn't contain any fields.
SciTech Software AB
Users browsing this forum: Google [Bot] and 11 guests