<UseSmallInternalThreadStacks> 元素<UseSmallInternalThreadStacks> Element

请求公共语言运行时(CLR)在创建其内部使用的某些线程时,通过指定显式堆栈大小来减少内存使用,而不是使用这些线程的默认堆栈大小。Requests that the common language runtime (CLR) reduce memory use by specifying explicit stack sizes when it creates certain threads that it uses internally, instead of using the default stack size for those threads.

<configuration>
  <runtime>
    <UseSmallInternalThreadStacks>

语法Syntax

<UseSmallInternalThreadStacks enabled="true|false" />  

特性和元素Attributes and Elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.

特性Attributes

属性Attribute 说明Description
已启用enabled 必需的特性。Required attribute.

指定是否请求 CLR 在创建其内部使用的某些线程时使用显式堆栈大小而不是默认堆栈大小。Specifies whether to request that the CLR use explicit stack sizes instead of the default stack size when it creates certain threads that it uses internally. 显式堆栈大小小于默认堆栈大小 1 MB。The explicit stack sizes are smaller than the default stack size of 1 MB.

enabled 特性enabled Attribute

Value 说明Description
truetrue 请求显式堆栈大小。Request explicit stack sizes.
falsefalse 使用默认堆栈大小。Use the default stack size. 这是 .NET Framework 4 的默认值。This is the default for the .NET Framework 4.

子元素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 assembly binding and garbage collection.

注解Remarks

此配置元素用于请求进程中减少的虚拟内存使用,因为 CLR 用于其内部线程的显式线程大小(如果请求被接受)小于默认大小。This configuration element is used to request reduced virtual memory use in a process, because the explicit thread sizes that the CLR uses for its internal threads, if the request is honored, are smaller than the default size.

重要

此配置元素是对 CLR 的请求,而不是绝对要求。This configuration element is a request to the CLR rather than an absolute requirement. 在 .NET Framework 4 中,请求仅适用于 x86 体系结构。In the .NET Framework 4, the request is honored only for the x86 architecture. 在未来版本的 CLR 中,可能会完全忽略此元素,或将其替换为所选内部线程始终使用的显式堆栈大小。This element might be ignored completely in future versions of the CLR, or replaced by explicit stack sizes that are always used for selected internal threads.

如果 CLR 接受请求,则指定此配置元素会在较小的虚拟内存使用情况下提高可靠性,因为较小的堆栈大小可能会导致堆栈溢出。Specifying this configuration element trades reliability for smaller virtual memory use if the CLR honors the request, because smaller stack sizes could potentially make stack overflows more likely.

示例Example

下面的示例演示如何请求 CLR 对其内部使用的某些线程使用显式堆栈大小。The following example shows how to request that the CLR use explicit stack sizes for certain threads that it uses internally.

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

另请参阅See also