I noticed that my windows application, very simple test written in C#, keeps
and keeps allocating memory.

For example, when at the start it has allocated 7500kB, after few minutes,
memory allocation is 12000kB. Even if i don't click any buttons or so. And
when i start clicking a button, with no event handling, it allocated 40k more
memory on every click. Is this normal? Why program needs extra memory after a
dummie button click?

I'm using .NET 2.0 and Visual C# Express, on WinXP Home with AMD64. Memory
figures are taken from task manager.

Re: .NET programs memory consumption by Willy

Willy
Mon Dec 19 10:49:44 CST 2005


"AIK" <AIK@discussions.microsoft.com> wrote in message
news:C63F11A5-79FE-4E36-A666-2E0A3D73EC6B@microsoft.com...
>I noticed that my windows application, very simple test written in C#,
>keeps
> and keeps allocating memory.
>
> For example, when at the start it has allocated 7500kB, after few minutes,
> memory allocation is 12000kB. Even if i don't click any buttons or so. And
> when i start clicking a button, with no event handling, it allocated 40k
> more
> memory on every click. Is this normal? Why program needs extra memory
> after a
> dummie button click?
>
> I'm using .NET 2.0 and Visual C# Express, on WinXP Home with AMD64. Memory
> figures are taken from task manager.

This is normal, the memory consumption will cease to climb at a certain
point, what you are experiencing is the result of JIT compilation and object
creation when clicking a button. Once all code in this execution path is
compiled the memory occupation will stabilize and the GC collector will take
care of the object clean-up (when he sees fit).

Willy.