Memory problem

  • Thread starter Thread starter Ofer B.
  • Start date Start date
O

Ofer B.

Hi

I have a combobox of customer names.
when I select a customer, I do a SQL query and get the customer details.
Than I insert all the details to 6 labels.

When the customer combo is in focus, I can change my selection by using the
joystick/navigation button.

If I press the joystick and don't stop I can move from the first customer to
the last (I have only 200).

And to the problem....

while I press the joystick the memory of the programs decrease until I get a
an exeption (sql ce exeption), or I get a message that I have to close one
of the programs in the device.

I use the Wis Bar and I can see that the status of the Memory is decreasing
while I press the joystick.

If I release the joystick, the status of the memory increase after 1-3
seconds.

What can be the reason? do I have to use the GC in order to release the
memory?
I use SP2, but the same behavior was in my IPAQ 2200 (SP2) and on QTEK 1010
(SP1).

Thanks
Ofer
 
Offer,

Check if the libraries you're calling implement IDisposable and if so, try
calling the Dispose(true) method. This should release any memory that may be
tied up without issuing a collect on the GC.

Hope this helps!

-Mike
 
Hi Ofer,

Maybe we can locate the problem İf you send eventhandler
for Combobox.SelectedIndexChanged event.
 
This is the Combobox.SelectedIndexChanged event:

private void cboCustomers_SelectedIndexChanged(object sender,
System.EventArgs e)

{

if(ifLoad == IfLoad.Yes)

return;

Customer cust =
SqlData.GetCustomersDetails(this.cboCustomers.SelectedValue.ToString());

this.lblCustNumber.Text = cust.m_CustNumber;

this.lblCustAddress.Text = cust.m_CustAddress.Trim();

this.lblCustCity.Text = cust.m_CustCity;

this.lblCustArea.Text = cust.m_CustArea.Trim();

this.lblCustPhone.Text = cust.m_CustPhone.Trim();

this.lblCustFax.Text = cust.m_CustFax.Trim();

this.panel2.Visible = true;

cust.m_CustName = this.cboCustomers.Text;

Global.CurrentCustomer = cust;


}

And this is class customer:

namespace SalesForce

{

/// <summary>

/// Summary description for Customer.

/// Class Customer save all the data for a customer.

/// </summary>

public class Customer

{

public string m_CustName;

public string m_CustNumber;

public string m_CustAddress;

public string m_CustCity;

public string m_CustArea;

public string m_CustPhone;

public string m_CustFax;

public string m_Cust;

public Customer()

{

//

// TODO: Add constructor logic here

//

}

public Customer(string CustNumber)

{

m_CustNumber = CustNumber;

}

public Customer(string CustNumber, string CustAddress, string CustCity,
string CustArea, string CustPhone, string CustFax)

{

m_CustNumber = CustNumber;

m_CustAddress = CustAddress;

m_CustCity = CustCity;

m_CustArea = CustArea;

m_CustPhone = CustPhone;

m_CustFax = CustFax;

}

public Customer(string CustNumber, string CustName)

{

m_CustNumber = CustNumber;

m_CustName = CustName;

}

#region Properties

public string CustName

{

get

{

return this.m_CustName;

}

}

public string CustNumber

{

get

{

return this.m_CustNumber;

}

}

#endregion











}

}
 
I found the problem! I didn't close the data reader.
Now, when I close the data reader, the memory status don't change.

Ofer
 
Back
Top