GCConserveMemory element

Configures the garbage collector to conserve memory at the expense of more frequent garbage collections and possibly longer pause times. Default value is 0 - this implies no change. Besides the default value 0, values between 1 and 9 (inclusive) are valid. The higher the value, the more the garbage collector tries to conserve memory and thus to keep the heap small. If the value is non-zero, the large object heap will be compacted automatically if it has too much fragmentation.

<configuration>
  <runtime>
    <GCConserveMemory>

Syntax

<GCConserveMemory
   enabled="n"/>

Attributes

Attribute Description
enabled Required attribute.

Specifies how hard the garbage collector should try to conserve memory.

enabled attribute

Value Description
n Default value is 0 - this implies no change. Besides 0, values between 1 and 9 (inclusive) are valid. The higher the value, the more the garbage collector tries to conserve memory and thus to keep the heap small.

Child elements

None.

Parent elements

Element Description
configuration The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime Contains information about assembly binding and garbage collection.

Remarks

This setting was introduced in .NET Framework 4.8.

See also