Re: PLS HELP! - Getting object size

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 02/16/05


Date: Wed, 16 Feb 2005 10:00:59 -0500

Andrey,

    It's not really easy to determine the size of an object in memory (after
all, an object might have references to other objects, and you have to find
the size of those objects, also, you have to hook into the profiling API, I
believe, to get this kind of information).

    Have you used the CLR profiler to take a look at the lifetime of your
objects? It would be much easier, IMO to go that way.

-- 
               - Nicholas Paldino [.NET/C# MVP]
               - mvp@spam.guard.caspershouse.com
"MuZZy" <leyandrew@yahoo.com> wrote in message 
news:qfSdnVeKYN2kxI7fRVn-tA@comcast.com...
> Hi,
>
> Is it ever possible to obtain an object's current size in managed memory?
> E.g. if i want to know what's the size in bytes occupied by the particular 
> DataSet object right now (of cource including it's tables, constraints, 
> reations and schemas).
>
> As i posted earlier the project i'm working on is experiencing dramatc 
> memory leaks and i can't seem to find exactly where the problem is. I 
> suspect that it's the DataSet derived class we are widely using that is 
> causing that, but as this class is used in tons of other classes and 
> places, i can't find which objects increase memory.
>
>
> Thank you,
> Andrey 


Relevant Pages