Memory Usage by DataTables

  • Thread starter Thread starter Brandon Owensby
  • Start date Start date
B

Brandon Owensby

I would like to know how much of the memory my application is taking up is
being taken up by a particular table. Is there a way I can see how much
memory a DataTable is using?

Thanks in advance for any help provided,
Brandon
 
There is System.Runtime.InteropServices.Marshal.SizeOf() to get the size of
objects. The only problem is that this method works with unmanaged data
only....
Till now, I couldn't find another method for managed data. I know I haven't
answered the question, but I hope my information leads you to the right path
in your research.
 
I don't know that you could figure it out exactly, but a couple controlled
tests will give you an idea.

Hopefully, you're running WinXP or Win2k. Run taskmgr.exe and click on the
Processes tab. One of the columns should be MemUsage. Run your application
and put a breakpoint right before the table is loaded. Check the MemUsage.
Step your code past the part where the table is loaded and check the
MemUsage again. Subtract your two numbers and you should get a rough idea.
This isn't exactly ideal, so run it a few times to make sure there aren't
any other factors involved. You should probably reboot between tests.
 
Back
Top