Stack capacity in C#(C# 中的堆栈容量)
问题描述
谁能告诉我 C# 中的堆栈容量是多少.
Could someone tell me what the stack capacity is in C#.
我正在尝试使用包含 30,000 个项目的数组来形成一个 3D 网格封闭对象.
I am trying to form a 3D mesh closed object using an array of 30,000 items.
推荐答案
.NET 应用程序的默认堆栈大小为 1 MB(32 位 ASP.NET 应用程序的默认堆栈大小为 256 KB,64 位 ASP 的默认堆栈大小为 512 KB.NET 应用程序),但您可以更改它.对于应用程序,您可以通过修改可执行文件的 PE 标头来更改默认大小.对于您创建的线程,您可以使用采用堆栈大小的构造函数重载.
The default stack size for a .NET application is 1 MB (default is 256 KB for 32-bit ASP.NET apps and 512 KB for 64-bit ASP.NET apps), but you can change that. For the application you can change the default size by modifying the PE header of the executable. For threads you create, you can use the constructor overload that takes a stack size.
但正如 Anton Tyjhyy 在他的回答中指出的那样,数组是引用类型,因此位于堆上(即使数组恰好包含一堆值类型).
But as Anton Tyjhyy points out in his answer, arrays are reference types and thus located on the heap (even if the array happens to hold a bunch of value types).
这篇关于C# 中的堆栈容量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C# 中的堆栈容量
基础教程推荐
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
