How to use large objects in C#

So you’ve got 64-bit Windows, lots of RAM, compiled your C# program as 64 bit application, and you still get the message that an object is too large? That’s because there’s a default 2GB limit to the size of objects. Luckily, there’s a way to disable this. You need to add the following lines to the <Configuration> block in the App.config XML file that sits in the Visual Studio project folder:


<runtime>
<gcAllowVeryLargeObjects enabled="true" />
</runtime>

 

Leave a comment

Your email address will not be published. Required fields are marked *