views:

146

answers:

3

Hi, I've a windows forms application. When i try to run this application it is increasing mem Usage continuously. How can i control this?

just my application contains only 10 to 15 database calls.

Code from comment to answer (there's no context though):

Label lbl = new Label();
lbl.Text = "my data label";
lblrss.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F,
                                      System.Drawing.FontStyle.Bold,
                                      System.Drawing.GraphicsUnit.Point,
                                      ((byte)(0)));
lblrss.Click += new EventHandler(llrss_Click);
mytbl.Controls.Add(lbl);

this is my code plz check it

thank you, Nagu

+3  A: 

maybe it's better you paste your code here.

Benny
just i've only one form form1.csin my form1.csbinddata(){ //databinding here}one more thing is i've a tiemr control in my page and i'm calling the binddata() method for every 30 secondstimer1_tick{binddata();}
Nagu
+2  A: 
  1. Make sure you are closing the Reader and Database Connection
  2. If you are adding event handlers to the dynamic data items, remove the event listeners before binding next time.

Without code, I can only give you these two points to focus.

Akash Kava
Label lbl = new Label(); lbl.Text = "my data label"; lblrss.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lblrss.Click += new EventHandler(llrss_Click); mytbl.Controls.Add(lbl); this is my code plz check it
Nagu
you should remove event handler of your lblrss.Click if its set everytime
Akash Kava
+3  A: 

Please give us more code and an explanation of what you expect it to do so we can help you, thanks.

angryface