I created this simple C# program expecting it to throw OutOfMemoryException. Problem is it works perfectly without using all my laptop memory. Why? How can I make it leak all the memory?
static void Main(string[] args)
{
for (int i = 0; true; i++)
{
new MustDispose();
}
}
class MustDispose
{
public MustDispose()
{
StreamReader r = null;
r = File.OpenText("C:\\Users\\rverdelli\\Desktop\\asd.txt");
if (r.EndOfStream) return;
Console.WriteLine(r.ReadToEnd());
}
}