CLR Profiler Question

CLR Profiler Question

am 28.01.2008 09:24:01 von Rohit

I am using the CLR Profiler to investigate the memory efficiency of my .NET
applications; however, I am puzzled as to the memory allocation size that the
tool reports for my applications.

I am profiling 2 applications: (1) a simple app that has 1 button which when
pressed displays the string "Hello World!" in a messagebox, and (2) a
slightly more complex application which populates a database with data from a
remote machine and then displays some of the data in a datagrid control.

This is what the CLR Profiler says is the memory utilization for the two
applications:

(1) Hello World app: 141K (total) / 141K (final)
(2) Database app: 1.8 M (total) / 870K (final)

The problem is that when I use task manager to check how much memory both
apps are using, I get a size that is much larger than what the profiler is
saying. In particular:

(1) Hello World app: 13 MB
(2) Database app: 21 MB

I do know that some of the difference is the memory used by the .NET
framework itself, but if you do math, you will find that the .NET framework
takes up less memory for the hello world app than it does for the database
app. This is the very thing that I am confused about.

Can somebody please explain this?

Re: CLR Profiler Question

am 28.01.2008 10:24:51 von forever.zet

On Jan 28, 10:24=A0am, Rohit wrote:
> I am using the CLR Profiler to investigate the memory efficiency of my .NE=
T
> applications; however, I am puzzled as to the memory allocation size that =
the
> tool reports for my applications.
>
> I am profiling 2 applications: (1) a simple app that has 1 button which wh=
en
> pressed displays the string "Hello World!" in a messagebox, and (2) a
> slightly more complex application which populates a database with data fro=
m a
> remote machine and then displays some of the data in a datagrid control.
>
> This is what the CLR Profiler says is the memory utilization for the two
> applications:
>
> (1) Hello World app: 141K (total) / 141K (final)
> (2) Database app: 1.8 M (total) / 870K (final)
>
> The problem is that when I use task manager to check how much memory both
> apps are using, I get a size that is much larger than what the profiler is=

> saying. =A0In particular:
>
> (1) Hello World app: 13 MB
> (2) Database app: 21 MB
>
> I do know that some of the difference is the memory used by the .NET
> framework itself, but if you do math, you will find that the .NET framewor=
k
> takes up less memory for the hello world app than it does for the database=

> app. =A0This is the very thing that I am confused about.
>
> Can somebody please explain this?

Hi,

I think that's because CLR allocates memory in chunks (several(many)
MB in size), so profiler shows memory used by the application, and
Task Manager shows total memory including memory reserved by CLR for
"future use".

Thanks,
Sergey