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
  • 29,269
  • 60
  • 159
  • 239

3 Answers3

1

I believe this is a duplicate. Check out:

Community
  • 1
  • 1
John Rudy
  • 36,472
  • 14
  • 63
  • 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
  • 29,269
  • 60
  • 159
  • 239
0
int size = Marshal.SizeOf(typeof(int));

That should work too.

justin.m.chase
  • 12,181
  • 6
  • 45
  • 93