4

After several outOfMemory exceptions, I enabled "gcAllowVeryLargeObjects", it works perfectly fine. I am now wondering why it is not a default option in C# (on a 64-bit platform).

Is it for pure compatibility reasons ? Or am I missing a major drawback of gcAllowVeryLargeObjects ?

Guy Coder
  • 24,501
  • 8
  • 71
  • 136
RUser4512
  • 1,050
  • 9
  • 23
  • 1
    Have you read [msdn](https://msdn.microsoft.com/en-us/library/hh285054.aspx)? There is only one caution and default value is usually respect *compatibility*. – Sinatr Jul 01 '15 at 09:01
  • look at the clr limitations https://iobservable.net/blog/2013/08/06/clr-limitations/ – Jagadeesh Govindaraj Jul 01 '15 at 09:11

1 Answers1

6

MSDN says:

Before enabling this feature, ensure that your application does not include unsafe code that assumes that all arrays are smaller than 2 GB in size. For example, unsafe code that uses arrays as buffers might be susceptible to buffer overruns if it is written on the assumption that arrays will not exceed 2 GB.

So as long you are not using unsafe code, there are no drawbacks.

Andy
  • 3,997
  • 2
  • 19
  • 39