⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 6.3.3.htm

📁 建立《编译原理网络课程》的目的不仅使学生掌握构造编译程序的原理和技术
💻 HTM
字号:
<html>

<head>
<title>编译原理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link type="text/css" rel="stylesheet" href="../css/specification.css">
</head>

<body>

<table align=right width=300>
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='6.3.2_3b.htm'"></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='6.4.0.htm'"></img></td>
</tr>
</table>
<br><br>

<font class="title2"><b>6.3.3 堆式存储分配</b></font>         

<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<P>
上面讨论的栈式存储分配不能用于下面两种情况: 
</p>
</td></tr></table>

     
<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<P>
1.局部名的值在活动结束时必须被保存。 
</p>
</td></tr></table>

<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
2.被调用者的活动生存期超过调用者。这种可能性不会出现在活动树能够正确描绘过程之间的控制流的语言中。 
</td></tr></table>

<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
在上面的每一种情况下,活动记录的释放不需遵循先进后出的原则,于是,存储空间不能组织成栈。 
</td></tr></table>

<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
堆式存储分配把连续的存储空间划分为若干小块,以供活动记录和其它目标的需要。而且块可以按任何顺序释放,这样过一段时间堆中将包含空闲区和正在使用的区。 
</td></tr></table>

<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
活动记录的堆式存储和栈式存储的区别可以从图6.14和图6.11中看出。在图6.14中过程r的活动记录在活动结束时被保留。q(1,9)的新的活动记录就不能象图6.11那样跟在s的后面。现在,如果保持的r 的活动记录被释放,在s 和q(1,9)的活动记录之间将会有空闲空间。这部分空间就留待堆管理程序以作它用。  
</td></tr></table>


<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>
<td class="content">
<p>
可以说,有效的堆管理问题在某种程度上是数据结构理论的专门问题,以上我们仅对堆式分配和栈式分配作了一个简单的比较。 
</td></tr></table>
<br>
<center><img src="6_14.gif"></center><br>

<br>
<table align=right width=300>
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='6.3.2_3b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='6.4.0.htm'"></img></td>
</tr>
</table>

</BODY>

<html><script language="JavaScript">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -