7

how do I write this in c# in the code behind? gcAllowVeryLargeObjects I can't use a config file.

below is the config files version

   <configuration>
  <runtime>
    <gcAllowVeryLargeObjects enabled="true" />
  </runtime>
</configuration>
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
Andre DeMattia
  • 631
  • 9
  • 23
  • 6
    It needs to be up front. In the .config file, it configures the CLR before it starts. You can therefore not write anything similar in C#. If you can't change the .config file then that's the end of it. Which is surely for the better. – Hans Passant Feb 28 '14 at 19:17

1 Answers1

4

You can't, because this configures how the runtime operates. You cannot modify how the runtime's garbage collector operates while the runtime is executing. You must do it before the runtime, thus the configuration requirement.

Haney
  • 32,775
  • 8
  • 59
  • 68