- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm debugging an application that fails with severe error 170, a stack overflow. The documentation for this runtime error requests the user consult the Release Notes for instructions on increasing the stack size, but I can't find them there.
The program has been generated on an Athlon 2200+ computer running Windows 2K Pro and is being run on a dual processor Pentium III computer running W2K Server. The application is large. I'm using some openMP code, but based on the traceback I'm getting, the overflow does NOT occur in the parallel section. I don't use the IDE at all. All the development is done from the command line. I'm using the following switches to compile all the source code:
/c /Qauto /check:all /stand:f95 /warn:general,declarations,unused,usage /debug:full /Od /trace
back /libs:static /Qopenmp_report2 /Qopenmp /threads /object:
Here are my questions:
1) What is the default stack size? Where can I find this information, or how?
2) How do I increase the stack size when I compile the code and then link the program? Am I correct in assuming that the linker sets the stack size, and I need only relink the program with the appropriate switch?
3) Can I use the EDITBIN /STACK command line directive to directly increase the stack size of the executable?
Thanks to all
Norm
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The default stack size is 1MB. In the IDE, you can change this in Properties under Linker..System..Stack Reserve Size. You can use EDITBIN for this.
Since you're using OpenMP, be aware that threads have their own stacksize. There is a section of the ifort documentation which discusses this - see the index under stack..size for threads.
I'll look into the issue of the incorrect pointer in the error message description.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
I am creating a DLL from CVF6.6 and calling it from C#. I already have some allocatable arrays as well as explicitly declared arrays. For e.g. array(x,25) etc. I decide the value of x from one input file. Now, if I add some more explicit arrays to code, it gives stak overflow. x is in order of 1000.
I want to increase the stack size limit. Do a EDITBIN is required in this case as I am creating DLL or I can specify in Project->Link settings?
We have CVF 6.6 as well as latest IVF version. I want to migrate my code to IVF once I resolve this issue. Should I do after migrating to IVF? Please let me know if IVF handles this in better way.
Also let me know if stack overflow is happening because of code similar to following.
The code is something like this:-
---------
double precision, allocatable :: H(:), alpha(:), TwTiTshell(:,:), yvalue(:,:)
allocate(H(x+1),alpha(x+1))
allocate(yvalue(x+1,25))
allocate (TwTiTshell(x,3))
call SolveModelODEs(25, x, alpha,yvalue, TwTiTshell)
---
subroutine SolveModelODEs(n, x, fill_angle, yval, TwTiTshell)
integer, intent(in) :: n, x
double precision, intent(in) :: fill_angle(x+1)
double precision, intent(out) :: yval(x+1, n), TwTiTshell(x,3)
---
Thanks,
Pradeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You must do the EDITBIN on the EXE, not the DLL. It is the EXE that determines the stack size.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You might consider turning on the "show temporary allocation" option on the compiler's run-time warnings option page. That will print out a line each time the code makes a temporary array on the stack.
Once you've found the places, you can factor out the array from the parameter list to avoid the stack overflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.I have some local arrays whosebounds depends on n. I have not shown those here. I have read Steve's article in DoctorFortran reg. stacks. I think I should use allocatable arrays instead of theselocal arrays in that subroutine. I am still passing the arrays to subroutine which will take up some space on stack. But looks like the error is because of those local arrays. I will check with 'show temporary allocation' also.
About my quetion related to EDITBIN, I have not understood whether specifying 'reserve' and 'commit' values for project to create dll will be Ok or not. Please post an example if possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using allocatable arrays for the local arrays is a good solution.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page