473,385 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

.NET forms doesn't get disposed

I wrote a simple form with a button, on click of a button it opens up another windows with few more buttons, listboxes etc. I noticed that when I click on the button the memory utilization goes up and when I close the window the memory doesn't get released. I also called the dispose method and also the GC.Collect() but still I don't see the memory getting freed but instead the utilization increases everytime I open the window. This is a major problem I am facing with one of my application at the client's place and the memory utilization goes so high that the application feezes after reaching a limit. I am using Dispose method in all the objects. I am ensuring all connections are closed and GC is called. What could be the problem? Appreciate any help/tips.
Jun 5 '07 #1
3 1071
vijay
30
I wrote a simple form with a button, on click of a button it opens up another windows with few more buttons, listboxes etc. I noticed that when I click on the button the memory utilization goes up and when I close the window the memory doesn't get released. I also called the dispose method and also the GC.Collect() but still I don't see the memory getting freed but instead the utilization increases everytime I open the window. This is a major problem I am facing with one of my application at the client's place and the memory utilization goes so high that the application feezes after reaching a limit. I am using Dispose method in all the objects. I am ensuring all connections are closed and GC is called. What could be the problem? Appreciate any help/tips.
hi,
can u post ur code pls and
try this,
On button click event in finally block call "this.Findform().Dispose()" method to clear previous form.
Hope it will work....

thanks and regards,
Vijay
Jun 5 '07 #2
Plater
7,872 Expert 4TB
What are you doing in there that causes so much memory to be eaten? I use this stuff on microcomputers and don't come near running out of memory.
Jun 5 '07 #3
Hi,
The test code I wrote was very simple

On btnTest_Click event

frmMyTestForm frmMTF = new frmMyTestForm();
frmMTF.ShowDialog();
frmMTF.Dispose();
frmMTF = null;

On the frmMyTestForm I have a Close button which calls this.Close()

frmMyTestForm has about 25 UI objects (buttons, listbox, etc) without any code attached for testing.

In my commercial application I have datagrids on the form and some UI objects. I am making sure all the data is cleared, the objects disposed and connections clcosed. But just the instantiation of the from object uses up lot of memory which is not getting freed. I tried to use Memory profiler and ensure the count of my form is 0 after closing by removing any static or circular references in the form etc. but still unable to clear the memory utilized.
Jun 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Andrew Dowding | last post by:
Hi Everybody, I have been looking at problems with my Windows Forms C# application and it's little Jet 4 (Access) database for the last few days. The Windows Forms app implements a facade and...
6
by: Edwinah63 | last post by:
Hi everyone, could someone give me some thoughts on the best way to manage mdi parent and child forms? in vb6 i could scroll through the forms collection and determine which forms were...
4
by: Anthony Nystrom | last post by:
Anytime I close a form should I also dispose such as me.clos me.dispos What else Should I dispose... If I set a var to nothing should I also dispose such as f = nothin f.dispos
3
by: Simon Verona | last post by:
I have a parent form which contains a toolbar. The toolbar controls the loading and switching to of MDI child forms. The code for the toolbar click event and one of the subroutines that loads...
0
by: Miro | last post by:
I searched google and I think I have solved the issue. Again, if someone could quickly skim over my example and lemmi know if it is the "correct" way of doing things. It works, but again - is it...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.