堆与堆栈 [英] Heap Vs Stack

查看:98
本文介绍了堆与堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道哪个是动态的。

如果我参考C内存模型(Richard Steven),它会显示两个

堆栈和堆朝向对方。

现在,可以进入其他区域,从而影响其他内存区域的大小。


是否存在堆栈或堆可以增长的任何限制。如果它是那么b $ b那么谁决定了这个限制?


plz澄清。

解决方案



Nehil写道:


我想知道哪些是动态的。

如果我参考C内存模型(Richard Steven),它会显示两个堆栈和堆堆积相互增长。

现在,可以进入其他'区域,从而影响其他内存区域的大小。


是否存在堆栈或堆可以增长的限制。如果它是b $ b那么谁决定了限制?


plz澄清。



C标准甚至没有定义术语堆栈。和堆,

虽然它们在大多数计算架构中很常见。这个组只有

讨论C由它的标准定义,因此你的问题是

不是主题。


有说,堆栈和堆的性质,如果确实存在一个或两个确实存在,通常更多地与系统的硬件

架构有关的操作系统比正常的C程序。所以

你的问题的可能答案取决于你的系统,它的系统软件和它的C实现的详细信息。发布到

一个合适的组,(例如Windows或Unix编程

组)。


< blockquote>文章< 11 ********************* @ q75g2000hsh.googlegroups。 com>,

Nehil< ne *********** @ gmail.comwrote:


> I我想知道哪个是动态的。
如果我参考C内存模型(Richard Steven),它会显示堆栈和堆都朝向彼此生长。
现在,可以一个进入其他区域,从而影响其他内存区域的大小。

堆栈或堆可以增长的限制是否存在。如果它在那里那么谁决定了限制?

请澄清。

http://groups.google.com/groups?q=st...up:comp.lang.c

dave


-

Dave Vandervies dj ****** @ csclub.uwaterloo.ca

一个真正聪明的动物会尝试表现得好像它不聪明一样,至少在人类周围时它们是b $ b。

- 理查德希思菲尔德在comp.programming


对所有人:

非常感谢您的回答。


= ================================================= = ================================================ <无线电通信/>

嗯,我明白标准对这两个条款没有任何说明

并且它们是特定于实现的。


我可以知道谁实现了C标准:是编译器,链接器,


请看下面的程序:


int i = 0;

int main(无效)

{

i ++;

printf("%d \ n",i);

main();

返回0;

}


每次执行程序时都使用相同的二进制文件/ exe或

不同(即通过再次编译)i的值是不同的。

我上次打印的价值取决于什么因素。

plea


请澄清。


================================ ================== ================================ =================


I would like to know which is dynamic in nature.
if i refer the C memory model (Richard Steven), it is shown that both
stack and heap grow towards each other.
Now, can one go into other''s area and hence effecting the size of
other memory area.

Does any limit exist upto which a stack or a heap can grow. and if it
is there then who decides the limit?

plz clarify.

解决方案


Nehil wrote:

I would like to know which is dynamic in nature.
if i refer the C memory model (Richard Steven), it is shown that both
stack and heap grow towards each other.
Now, can one go into other''s area and hence effecting the size of
other memory area.

Does any limit exist upto which a stack or a heap can grow. and if it
is there then who decides the limit?

plz clarify.

The C Standard does not even define the terms "stack" and "heap",
though they''re common in most computing architectures. This group only
discusses C as defined by it''s Standard and hence your questions are
not topical.

Having said that, the nature of the stack and the heap, if one or both
do exist, usually have more to do with the system''s hardware
architecture and it''s operating system than a normal C program. So
possible answers to your questions are dependent upon the details of
your system, it''s system software and it''s C implementation. Post to
an appropriate group, (for example a Windows or Unix programming
group).


In article <11*********************@q75g2000hsh.googlegroups. com>,
Nehil <ne***********@gmail.comwrote:

>I would like to know which is dynamic in nature.
if i refer the C memory model (Richard Steven), it is shown that both
stack and heap grow towards each other.
Now, can one go into other''s area and hence effecting the size of
other memory area.

Does any limit exist upto which a stack or a heap can grow. and if it
is there then who decides the limit?

plz clarify.

http://groups.google.com/groups?q=st...up:comp.lang.c
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
A truly intelligent animal would try to act as if it were not intelligent,
at least when around humans.
--Richard Heathfield in comp.programming


To all :
Thanks a lot for ur answers.

================================================== =================================================

Well, i understand that standards say nothing about these two terms
and they are implementation specific.

may i know who implements the C standard : is it compiler, linker,
loader, OS or some combination of these with some collaboration.

plz look at the following program :

int i=0;
int main(void)
{
i++;
printf("%d\n",i);
main();
return 0;
}

each time the the program is executed, with same binary/exe or
different (i.e. by compiling again) the value of i is different.
on what factors the value of i last printed, depends upon.
plea

please clarify.

================================================== =================================================


这篇关于堆与堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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