<Gcallowverylargeobjects> > 項目<gcAllowVeryLargeObjects> Element

在 64 位元平台上,啟用總大小大於 2 GB 的陣列。On 64-bit platforms, enables arrays that are greater than 2 gigabytes (GB) in total size.

<組態 > 項目<configuration> Element
<執行階段 > 項目<runtime> Element
<Gcallowverylargeobjects> > 項目<gcAllowVeryLargeObjects> Element

語法Syntax

<gcAllowVeryLargeObjects    
   enabled="true|false" />  

屬性和項目Attributes and Elements

下列各節描述屬性、子項目和父項目。The following sections describe attributes, child elements, and parent elements.

屬性Attributes

屬性Attribute 描述Description
enabled 必要屬性。Required attribute.

指定是否在 64 位元平台上啟用的總大小大於 2 GB 的陣列。Specifies whether arrays that are greater than 2 GB in total size are enabled on 64-bit platforms.

啟用屬性enabled Attribute

Value 描述Description
false 陣列大於 2 GB 的大小總計不會啟用。Arrays greater than 2 GB in total size are not enabled. 這是預設值。This is the default.
true 陣列大於 2 GB 的總大小是 64 位元平台上啟用。Arrays greater than 2 GB in total size are enabled on 64-bit platforms.

子元素Child Elements

無。None.

父項目Parent Elements

項目Element 描述Description
configuration 通用語言執行平台和 .NET Framework 應用程式所使用之每個組態檔中的根項目。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有關執行階段初始化選項的資訊。Contains information about runtime initialization options.

備註Remarks

使用您的應用程式組態檔中此項目會啟用大於 2 GB 大小的陣列,但不會變更的物件大小或陣列大小的其他限制:Using this element in your application configuration file enables arrays that are larger than 2 GB in size, but does not change other limits on object size or array size:

  • 陣列中的項目數目上限是UInt32.MaxValueThe maximum number of elements in an array is UInt32.MaxValue.

  • 2,147,483,591 (0x7FFFFFC7) 的位元組陣列與單一位元組結構的陣列和其他類型的 2,146,435,071 (0X7FEFFFFF) 中任何單一維度的最大的索引。The maximum index in any single dimension is 2,147,483,591 (0x7FFFFFC7) for byte arrays and arrays of single-byte structures, and 2,146,435,071 (0X7FEFFFFF) for other types.

  • 字串和其他非陣列物件的大小上限不會變更。The maximum size for strings and other non-array objects is unchanged.

警告

之前啟用這項功能,請確定您的應用程式不包含不安全的程式碼假設所有陣列都是小於 2 GB 的大小。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. 例如,陣列做為緩衝區的 unsafe 程式碼可能容易發生緩衝區溢位如果寫入假設陣列不會超過 2 GB。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.

範例Example

下列範例示範如何啟用此功能的應用程式。The following example shows how to enable this feature for an application.

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

另請參閱See also