Last post Jul 11, 2007 03:16 PM by Michael Nemtsev
Jul 11, 2007 11:20 AM|Mundo|LINK
Can anyone advise as to whether there are any low level functions that allow me to query
exactly how much memory an object or set of variables is occupying? Are there any such functions in C#? Or is the best way to use CLRProfiler? The trouble is, I find CLRProfiler a bit complicated to use, so am looking for a way to pinpoint
exactly what a particular array is consuming. I can predict what a test dataset should occupy, but I want to confirm that my calculations are correct using some specific technique. I have a very limited experience of C, and so cannot remember much of it, but
my boss tells me he used to use some functions in C to get exact memory allocations that he could print out. He wants me to do something similar with my current project to get an idea of resources being consumed.
Any help will be much appreciated. Cheers.
Jul 11, 2007 03:16 PM|Michael Nemtsev|LINK
There is no way to measure the righ size of your object in .NET as it was in C++ and C, because .NET is slightly different from C/C++ Everything you can get is use profiling tools, like performance counters or dotTrance to measure memory consumption
Yoy can only get the rough size of your dataSet, because, depending on the context of usind DataSet the memory consumtion will be very different. For example DataSet in ASP.net are 4 times bigger after being rendered from their initial size.