is a good method, I unset variables after function execution?
Well,I need better performance for my C# application
I need to consume less memory ram possible’s
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.
Variables of value types (most built-in types like int, char, bool, as well as structs) will normally have their memory reclaimed immediately when a function returns, since they are allocated “on the stack” (which means they are part of the data structure that gets created when a function begins execution, and is freed when the function returns).
Variables of reference types will be automatically freed by the garbage collector when they are no longer needed.
Memory not being freed when functions return is unlikely to be what is causing problems with your program.
As another answer stated, do not optimize unless you have hard evidence of where the problem lies.