<p>What is the easiest way to find out how much memory an object uses in .NET?</p>

<p>Preferably without having to resort to a third party tool.  Marshal.SizeOf or the sizeof operator look useful but only work with a restricted range of types.</p>

<p>Some related posts:</p>

<ul>
<li><a href="https://stackoverflow.com/questions/109836/object-memory-analysis-in-net">Object Memory Analysis in .NET</a></li>
<li><a href="https://stackoverflow.com/questions/151936/does-an-empty-array-in-net-use-any-space">Does an empty array in .NET use any space?</a></li>
</ul>

Asked and answered here:
Determine how much memory a class uses?
The quick summary is that if you don't want to use a tool, you need to use the
.NET Profiling API
The Profiling API is amazingly powerful, but I don't think it would qualify as "easy" by any stretch of the imagination, so I would strongly recommend using a memory profiling tool - there are some free ones that are OK, and some not-too-expensive commercial ones (
JetBrains dotTrace
in particular) that are really good.