I was asked this question in one of my job interviews. I dont know the right answer so am putting it out for people to respond.
If you encounter an OutOfMemoryException then how will you be able to narrow the scope of the problem ?
I said use a profiler and see all the usefull stats like how many objects are getting created, how many are getting destroyed etc and figure out the piece of code thats causing the problem. Once you are able to narrow the scope of the problem go through the particular code and look for place where objects are getting instantiated but somehow not getting garbage collected.
To this the interviewer asked if there is a long running suite of test scripts and this error is encountered after 4 hrs since the script started executing then how would you figure out the source of the problem ?
I was not able to give a convincing answer for this question. Can someone share your experiences for this question ?