Given the opportunity to rewrite, I would, but anyway, the code as it stands:
List foobar;
Then we add a bunch of strings to
If you're trying to use very large lists in 64 bit environments you need to enable large objects in the application configuration.
http://msdn.microsoft.com/en-us/library/hh285054.aspx
The OOM is likely due to the way Lists/ArrayLists allocate memory, which I believe is each time their boundary is reached, they attempt to double in size. The list cannot double from 2^24. You could theoretically maximize your list size by pre-specifying a size. (I.e. 2GB)