I notice in the VS2010 javascript intellisence there is a method called CollectGarbage().
Is this an IE only method?
When should it be used?
What are the advantages (or disadvantages) to using it?
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.
You might want to take a look at this post by Eric Lippert.
Nope. It’s part of JScript, so anything that implements JScript (including IE, of course) should support it.
When you want to hint garbage collector to start doing its job. Arguably, it shouldn’t be used at all, and instead just let things happen on their own.
I’m not aware of any disadvantages. Before using it, I would perform some tests to see if there are actual benefits in memory usage.