I'm making a C# application currently in WinForms, and am facing memory leak issues.
When the user clicks a button, a method is called, where new variables are being created. They can catch 50M-100M in RAM (sometimes it's file handling, but it happens with every other type of variable as well).
Now, the problem is, after the method is completed, the memory still remains at 50M-100M, and it appears as if they're (the variables) not being destroyed (I watch the memory being used with Task Manager).
If I created them inside a method, shouldn't the GC destroy them when the method ends? And if it does destroy them, why do it still shows high memory usage?
Or maybe is it related to the fact that the method is being called by a button click event? I also run the program in the VS debugger, if that matters.
So, what should I do to avoid this? The variables are 100% not global so it's not this type of problem.