I have a UI, winform, It has loads of controls like tabcontrols, Plenty of text boxes(min 25 spread across tabs) comboxes, checkboxes, buttons, labels, tree control etc.
most of these controls register for ctrl events like textchanged, click etc... Since i am getting this out of memory exception and all i have few queries:
Questions:
- In the dispose function of the form should dispose of each of this ctrl be called ?
- Should the events subscibed by the ctrls like the textchanged, click event etc be de-registered in the dispose function ? Does the GC take care of de registering the events added for the ctrls, as the code snippets are added in the designer?
Some Info: The application was put on a stability test for upto 100 iterations on a 2GB ram machine. Each iteration it would execute the same test(launching teh dialog, doing some clicks or editing some values, and closing). It was on running for almost 8 hrs. on the 45 th or the 46 th iteration it threw this exception. Yes all the controls in the dialog have one event or ther other registered. some text changed some checkedchanged or click etc