关键词不能为空

当前您在: 主页 > 英语 >

运行时错误:Stack Overflow的解决办法

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-08 13:34
tags:

-

2021年2月8日发(作者:peephole)


运行时错误:


Stack


Overflow< /p>


的解决办法


.txt


这世界上除了我谁都 没资格陪在你身边。




< p>
着,


我允许你喜欢我。


除了白头偕老,

< p>
我们没别的路可选了什么时候想嫁人了就告诉我


,


我娶


你。




现象:



编译正常通过,但运行时出现——




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->Ca tegory=output->stack allocations


设一个足够大的值就行








参考:



/fortran/visual/vfn10/#Doctor



Issue


2001



/fortran


Doctor Fortran - Don't Blow Your Stack!


Steve Lionel


Visual Fortran Engineering



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



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


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


(


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


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


routine is called to


used again by a future allocate call. You can think of this as similar to


borrowing money from a bank, and then later paying it back (except that


there's no interest!)

-


-


-


-


-


-


-


-



本文更新与2021-02-08 13:34,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/614847.html

运行时错误:Stack Overflow的解决办法的相关文章

  • 爱心与尊严的高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊严高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊重的作文题库

    1.作文关爱与尊重议论文 如果说没有爱就没有教育的话,那么离开了尊重同样也谈不上教育。 因为每一位孩子都渴望得到他人的尊重,尤其是教师的尊重。可是在现实生活中,不时会有

    小学作文
  • 爱心责任100字作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任心的作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文