|A few years back I came across following piece of code during code review that got me really puzzled.
I couldn’t think of any good reason as to what purpose this code would serve. Couldn’t resist and asked the developer of his intention. It was a long discussion but summary is that application was very memory intensive so developer added this as a check on the state of application if it has any memory left to instantiate anymore objects.
Fast foward last week, I was having a discussion with a developer and he was struggling with coming up with a strategy to include some checks to ensure enough memory is available before requestintg a large chunk of memory. I asked him if he heard about MemoryFailPoint class in System.Runtime namespace and he didn’t know about it. Now I am not going to create a detailed description of how to use this class because if you google MemoryFailPoint, it will provide you enough examples. Just thought of sharing it with my 2 blog followers 🙂 in case they are not aware of it.