To make a general idea: I am trying to develop an application which, in the state I've brought it to, uses a dozen of globally declared List(s) and List(s)>, where the "T"'s are generally Textboxes, and a Class.
The Lists and Lists(of)Lists are used to store data manually introduced by the user in a graphical interface, while the Class is used for storing data related to an object, data which is also manually introduced into some TextBoxes.
The user can also Add/Remove both those Controls (Stackpanels / Wrappanels containing one or more groups of TextBlock-TextBox) and those Objects (Class type) . The whole data will then be written in an XML file.
Issue: I am trying to figure out how to free/release the memory which is allocated for the Controls/Objects after these are removed graphically and from the List(s), because I discovered that the no. of Kbs only increases during the execution of my app.
My questions:
- Do I have to worry about memory being allocated for the Controls/Objects and not being released?
- If the answer to (1.) is YES, then how can I release the allocated memory?
- Is "Class" the right way to define the structure of an object or should I use the "Struct" for this matter?
EDIT:
I have to mention that when the application starts, a "Menu" window is opened, which gives the user the possibility to create one or more New "User interface" windows (in which data is actually introduced) / to Open one or more previously created "User interface" windows (with data now read from an XML) -> which also lead to a substantial increase in memory usage.
NOTE: Memory used when:
- the first window appears: ~ 12.000 K
- one New window is created: ~ 19.000 K
- you add Controls/Objects: going up