In a meeting the other day one of my colleagues mentioned we might need to move one of our applications to 64-bit, mainly because it was memory bound and was restricting the number of threads. Incase you don’t know, .NET 32 applications are restricted to 2GB, whereas (atleast I believed) 64-bit applications aren’t under the same limitation (atleast in terms of total memory usage).
However another colleague came out and said that 64-bit .NET is restricted to only using 4GB of memory, which made no sense to me whatsoever, knowing that .NET is used on servers all over the world and a limitation like this would make it laughable for a server app. Rather than arguing the point based what other people say (and being abit of a pragmatist) I decided to right then and there write a little test:
static void Main() { var list = new List<int[]>(); while (true) { try { list.Add(new int[1024]); } catch (OutOfMemoryException) { Thread.Sleep(1000); } } }
Simple? Yes,
Is it crude? Yes
Does it cause most applications (including Visual Studio itself) to freeze/become unresponsive when it is run? Yes.
But when you run it, it will use up all RAM available on a machine (unless you have so much RAM that you actually manage to add more elements to list than it can contain, in which case you must be reading this from a bunker or 10-15 years in the future). Which is all the evidence you need.
This should go without saying since I have already mentioned that this code is not exactly safe, but I take no responsibility for anything that happens when using it. I mean seriously, it’s an application that aggressively takes all available resources and never frees them, of course it is only going to cause you problems when you run it.

