百科问答小站 logo
百科问答小站 font logo



程序中的堆和栈大小是动态变化的,还是相对固定的? 第1页

  

user avatar   bei-ji-85 网友的相关建议: 
      

堆和栈的大小在加载的时候是确定的,但也是可以调整的,是否允许动态调整完全看操作系统是否支持。

所以,两个问题:

1. 你用的OS是什么?
2. 你用的开发语言是什么?

栈是面向于线程的,堆有可能是整个进程共用的,也可能是有好几个堆,每个线程用各自的。

Windows里MSDN有讲:

       BOOL WINAPI SetThreadStackGuarantee(   __inout  PULONG StackSizeInBytes );      

StackSizeInBytes
The size of the stack, in bytes. On return, this value is set to the size of the previous stack, in bytes.
If this parameter is 0 (zero), the function succeeds and the parameter contains the size of the current stack.
If the specified size is less than the current size, the function succeeds but ignores this request. Therefore, you cannot use this function to reduce the size of the stack.
This value cannot be larger than the reserved stack size.





  

相关话题

  怎样评价《数码宝贝》第一部中的泉光子郎的编程水平? 
  如何评价不认为C++三大特性是封装、继承、多态的程序员? 
  到底存在不存在不适合学编程的人? 
  初中未毕业的人自学得了编程吗? 
  一个关于拓扑排序的扩展问题,可以做到的最优复杂度是? 
  为什么说「动态类型一时爽,代码重构火葬场」? 
  能否使用3的指数来减小二进制文件存储的体积? 
  数据库设计时的一些细节的东西如何处理? 
  Objective-C 的一些函数名为什么都这么长? 
  大一学生,刚开始学习编程,但感觉自己并没有天赋怎么办? 

前一个讨论
普通人骑自行车的时速多少?
下一个讨论
操作系统中到底是谁分配的资源?





© 2025-04-13 - tinynew.org. All Rights Reserved.
© 2025-04-13 - tinynew.org. 保留所有权利