是否有一个最高限额为变量的大小应该在栈上分配? [英] Is there a maximum limit to the size of a variable that should be allocated on a stack?

查看:285
本文介绍了是否有一个最高限额为变量的大小应该在栈上分配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我宣布在尺寸上比1024bytes更大℃的结构体变量。在运行Coverity公司(静态code分析仪应用),它会报告这个堆栈变量大于1024字节,因此错误的原因。
我想知道我是否需要担心这个警告?是否真的有最大限制为单个堆栈变量的大小?

i declared a struct variable in C of size greater than 1024bytes. On running Coverity (a static code analyzer application) it reports that this stack variable is greater than 1024 bytes and therefore a cause of error. I'd like to know if I need to worry about this warning? Is there really a maximum limit to the size of a single stack variable?

谢谢,

推荐答案

变量的最大尺寸的限制由堆栈(具体地,如何在堆栈中有多少来自任何当前使用包括变量遗留的最大尺寸与从功能更高栈上参数以及处理框架开销)。

The maximum size of a variable is the limited by the maximum size of the stack (specifically, how much of the stack is left over from any current use including variables and parameters from functions higher on the stack as well as process frame overhead).

在Windows中,第一个线程的堆栈大小是可执行集的属性联同时可以在的线程创建

On Windows, the stacksize of the first thread is a property of the executable set during linking while the stacksize of a thread can be specified during thread creation.

在Unix上,第一个线程的堆栈大小通常只只有有多大的空间,它成长的限制。根据特定的Linux下如何勾画出记忆和您的共享对象的使用,即可以改变。 线程的创建过程中也可以指定一个线程的堆栈大小。

On Unix, the stacksize of the first thread is usually only limited only by how much room there is for it to grow. Depending on how the particular Linux lays out memory and your use of shared objects, that can vary. The stacksize of a thread can also be specified during thread creation.

这篇关于是否有一个最高限额为变量的大小应该在栈上分配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆