Reducing memory usage

  • Thread starter Thread starter =?ISO-8859-1?Q?Mikko_Nyl=E9n?=
  • Start date Start date
?

=?ISO-8859-1?Q?Mikko_Nyl=E9n?=

Is it somehow possible to reduce memory usage in Windows.Forms applications?

Now when I create a empty form with code

--

namespace FormTest
{
using System.Windows.Forms;

public class Testform
{
[STAThread]
static void Main()
{
Form form = new Form();
form.Visible = true;
Application.Run(form);
}
}
}

--

it takes ~14 MB of memory when compiled with debug configuration. When
compiled with release configuration, it takes 9 MB. I also tryed to
restart application for a couple of times, but the memory usage wont
decrease.

What can I do? If every form takes >= 9 MB, it could be a quite big
performance bottleneck for larger applications.

Thanks in advance.

- Mikko Nylén
 
Mikko Nylén said:
Is it somehow possible to reduce memory usage in Windows.Forms
applications?

Now when I create a empty form with code

--

namespace FormTest
{
using System.Windows.Forms;

public class Testform
{
[STAThread]
static void Main()
{
Form form = new Form();
form.Visible = true;
Application.Run(form);
}
}
}

--

it takes ~14 MB of memory when compiled with debug configuration. When
compiled with release configuration, it takes 9 MB. I also tryed to
restart application for a couple of times, but the memory usage wont
decrease.

What can I do? If every form takes >= 9 MB, it could be a quite big
performance bottleneck for larger applications.

Not every form will take >= 9 MB. Note that Windows Forms applications will
load some larger libraries which take some megabytes.
 
Herfried said:
Mikko Nylén said:
Is it somehow possible to reduce memory usage in Windows.Forms
applications?

Now when I create a empty form with code

--

namespace FormTest
{
using System.Windows.Forms;

public class Testform
{
[STAThread]
static void Main()
{
Form form = new Form();
form.Visible = true;
Application.Run(form);
}
}
}

--

it takes ~14 MB of memory when compiled with debug configuration. When
compiled with release configuration, it takes 9 MB. I also tryed to
restart application for a couple of times, but the memory usage wont
decrease.

What can I do? If every form takes >= 9 MB, it could be a quite big
performance bottleneck for larger applications.


Not every form will take >= 9 MB. Note that Windows Forms applications
will load some larger libraries which take some megabytes.

Thanks for the reply. I also found some time after writing my post that
the Task Manager shows the amount of memory allocated for the program
and when minimizing the form, the "memory usage" will drop down to about
600 KB.

- Mikko NYlén
 
Back
Top