When it’s good to clear your memory?
Never. I’ve answered that before.
The ideal time is when to open and close the screen?
Never!
On all screen buttons?
Never!
What problems can be caused by excessive use of GC?
Breaks and loss of performance.
What harm can it do to free the memory?
That is the real question that must be asked. The problem is more about manual memory release than about leaving without doing it. Pauses will be more frequent and longer. If there was a memory problem, now there is a problem managing it. I won’t go into detail because that’s already explained in the other question.
You may have an exaggeration of memory usage due to wrong architecture or release failure. The release is automatic, but the programmer has to know how to do. He can’t keep references to the objects.
Real problem
I’ve seen cases of one window calling another calling the first, then it turns into a terrible vicious cycle. But most cases aren’t so terrible, but objects are kept alive longer than they need to.
There is a case they leave leaking longer than it should. There are pre objects that need explicit release, at least using the using
.
I see most programmers making code without thinking about how it works. They just want to see the result. It doesn’t work. It takes planning. Not knowing how everything works is at the mercy of coincidence. It may or may not work.
I do not know what is the case with this application, but it is possible that you have serious problems managing the objects. Maybe you will have to make a Profiling. has tools for this:
You can’t rule out the possibility that the application simply needs more memory. There are cases like this. But before investing in hardware need to make sure that solved all software.
Now you have better subsidies to start thinking about the right problem and who knows how to ask specific questions.
"I started putting in almost everywhere" what that means?
– Maniero
I got excited and put in buttons and builders, for example... Where I thought I was critical, I put... But I don’t know if it’s right.
– Érik Thiago
Put what?.
– Maniero
The GC.Collect();
– Érik Thiago