Can we Determine the availability of sufficient memory for an operation? if yes, then how can?
Thanks
Can we Determine the availability of sufficient memory for an operation? if yes, then
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.
No, you absolutely cannot do this as you don’t know in advance how much memory the operation will consume. If anyhow you know exactly how much memory the operation will consume you could query the available system memory and make an approximation but don’t rely on it. Remember that Garbage Collection is pretty indeterministic and might kick in at any moment messing up with your approximations. You could get an OutOfMemoryException anytime.
So focus on writing quality code instead of this.