运行时错误:stackoverflow的解决办法

库顶切换运行时错误:Stack Overflow的解决办法.txt这世界上除我谁都没资格陪在你身旁。  听着,我允许你喜欢我。除白头偕老,咱们没别的路可选了何时想嫁人了就告知我,我娶你。  现象:
编译正常通过,但运行时出现——
forrtl: severe (170): Program Exception - stack overflow
Image PC Routine Line Source
00401A73 Unknown Unknown Unknown
004029B9 Unknown Unknown Unknown
00449929 Unknown Unknown Unknown
0042EDB9 Unknown Unknown Unknown谷氨酰胺合成酶
77E7CA90 Unknown Unknown Unknown
Incrementally linked image--PC correlation disabled.
Press any key to continue
解决方式:                                                                  百花仙酒
在project->settings->link->Category=output->stack allocations
设一个足够大的值就行                                                     
参考:
               
Issue
2021                                                                       
 
Doctor Fortran - Don't Blow Your Stack!
Steve Lionel
Visual Fortran Engineering
"Doctor, my stack is overflowing! What does it mean?! Is there a cure?!" The
Doctor frequently sees questions like these, and he realizes it's time for a
general article on the subject of stack allocation, as well as the other
memory allocation types, static and dynamic.
Static allocation
"Everybody's got to be somewhere," the saying goes. And so it is with your
program's data - it has to live somewhere in memory while it is being
referenced (registers are a special kind of memory we won't get into here.)
The compiler, linker and operating system work together to determine exactly
where in memory a piece of data is to reside. The simplest method of
assigning locations is "static allocation", where the data is assigned a
fixed (static) address by the compiler and linker in the executable image
(EXE). For example, if variable X is statically allocated at address 4000,
it is always at address 4000 when that EXE is run, no matter what else is
going on in the system. (DLLs can also have static data - it is allocated at
a fixed offset from the base address where the DLL gets loaded.)
Static allocation is simple from the compiler's perspective because all that
is needed is to create a list of variables that need allocation, and lay
them down in memory one after the other. A run-time advantage of static
allocation is that it is usually easy and fast to access a fixed address and
免清洗助焊剂
光盘封套statically allocated data can be used from anywhere in the program. But
static allocation has disadvantages too. First, if you have any reentrant or
parallel code, the multiple codestreams are both trying to use the same
data, which may not be wanted. Second, if you have many routines which need
a lot of memory just while they're executing, the available address space
can fill up quickly (for example, ten routines each of which declares a
1000x1000 REAL(8) array need a total of 80,000,000 bytes just for those
arrays.) And perhaps most important, with static allocation you must know at
compile-time how much memory you will want.
Up through Fortran 77, the Fortran standard was carefully written in a way
so that static allocation was the only method needed. Even today, static
allocation is the most widely used method - in Visual Fortran, COMMON blocks
and most variables with the SAVE attribute are allocated statically. (Note
that Visual Fortran, by default, implies SAVE for local routine variables
unless it can see that the variable is always written before it is read.)
Dynamic allocation
Dynamic allocation is the complete opposite of static allocation. With
dynamic allocation, the running application must call a system routine to
request a particular amount of memory (for example, 1000 bytes). The system
routine looks to see if that request size is available in the collection
("heap") of memory segments it has available. If the request can be
satisfied, a range of memory addresses is marked as used and the starting
address is returned to the program. If the heap is empty, the operating
system expands the virtual address space of the process to replenish the
cn-m
heap, stopping only if there is no more virtual memory available. The
program stores the base address in a pointer variable and then can access
the memory. When the program no longer needs the memory, another system

本文发布于:2024-09-20 14:48:15,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/2/104370.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:运行   世界   切换   喜欢   嫁人   解决   百花   清洗
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议