Reducing memory usage

  • Thread starter =?ISO-8859-1?Q?Mikko_Nyl=E9n?=
  • 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
 
H

Herfried K. Wagner [MVP]

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.
 
?

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top