Reputation: 5771
I am attempting to perform a perverse memory trick by calculating the size of an object (one of many in a serial fashion), so I can jump forward in the memory stream to the next one.
This is for a managed class. I've seen reference to sizeof and Mashal.SizeOf, but they appeared in reference to unmanaged types or value types.
So, does anyone know a way to do this at runtime, or should I break out the calculator and it do it manually in the code?
Upvotes: 3
Views: 1852
Reputation: 7480
You cant get size of object if you dont use unsafe coding (marshal)
You can use a tool like:
CLR Profiler
VSTS Profiler
.NET Memory Profiler
Upvotes: 4