patrick

patrick

  • NA
  • 397
  • 0

Memory leak problem

Mar 3 2011 9:28 PM
My program is hitting 500,000k memory and more until it crashes. It uses 50,000k when it first loads. I realized that it climbs in usage and never goes down, and I think I have narrowed the problem down to the way I am switching forms.  Here is my code:

if (Properties.Settings.Default.isCashRegister)
{
callerIDTimer.Enabled = false;
if (Functions.IsConnectionAvailable())
{
if (Settings.Default.NumberOfRegisters != 1)
{
var cashRegisterInstance = new cashRegisterForm(Properties.Settings.Default.registerNumber);
}
else
{
var cashRegisterInstance = new cashRegisterForm(1);
Hide();
cashRegisterInstance.Show();
cashRegisterInstance.FormClosed += Instance_FormClosed;
}
}
else
{
MessageBox.Show(Classes.ErrorMessages.ConnectionError1.ToString());
}
}
else
{
MessageBox.Show("Not a cash register station.");
}

Does anyone know where the problem might be?

Answers (11)