0

I would like to be able to know, in run-time in my code, how much memory a certain object is taking (a Dataset in this case, but i'm looking for a "general" solution).

Is this possible through reflection?

This is for .Net 2.0.

Thanks!

Daniel Magliola
  • 30,898
  • 61
  • 164
  • 243

3 Answers3

1

I believe this is a duplicate. Check out:

Community
  • 1
  • 1
John Rudy
  • 37,282
  • 14
  • 64
  • 100
0

Great, so to sumarize, there is no easy way, other than using the Profiling API which is a lot of work. Thanks!

Daniel Magliola
  • 30,898
  • 61
  • 164
  • 243
0
int size = Marshal.SizeOf(typeof(int));

That should work too.

justin.m.chase
  • 13,061
  • 8
  • 52
  • 100