Even though there is no event related to the button, every time i clicked the button the memory usage increases slowly. What causes this? Thank you.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
.NET used a managed memory model, that means that there is a garbage collector that is responsible for freeing memory for objects that are no longer needed. Rather than spending the time and effort of freeing memory for each object as soon as possible, the garbage collection waits until the system needs memory or enough time has passed that it decides to perform a collection. When that collection is performed it will go around and look for objects that don’t need to be in memory any more and deallocate them. (In reality it actually finds everything that is needed, and saves all of those, leaving everything that wasn’t saved to go away, but you don’t need to think of it that way.)
In most all instances the GC does a great job of managing memory. You simply shouldn’t think about it most of the time.