I’ve built an application which essentially comes in and out of focus when the user has satisfied the global hook, what i want to know (and i apologise if this is a duplicate) is creating a new instance of a form and showing it to the user which could be done many times during the applications lifetime, is this creating the same form many times in memory?
Any guidance would be much appreciated on disposing correctly of forms, what would be best is creating one form instance and only showing that form during the applications lifetime, perhaps a class level form instance?
Normally the form instances you created will be automatically garbage collected when they are closed and no longer referenced from any code (keep an eye out for even handlers). So it shouldn’t be a problem.
Edit: However if you often show and hide the form and you can easily change the code to make it use the same formular then go for it, because sometimes memory leaks are difficult to recognize, especially in case of events, etc.