- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Colleagues,
I gave a subroutine that uses automatic arrays. In some (rare) occasions, there isn't enough memory and the call to the routine generates a "stack overflow" error. The automatic arrays are too large. Is there a way to trap the memoray allocation failure within the routine, so that I can set a error flag and do a graceful return? I being careful here to say "automatic arrays", not "allocatable arrays." I don't want to use allocatable arrays in this routine.
David
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The options to fix the stack overflow are to either increase your stacksize or to tell the compiler to allocate automatic arrays on the heap rather than the stack. Unfortunately, I'm not familiar with exactly where these options are in the VC shell, though I would expect someone will follow up and let you know where to find those.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
David,
Making the array allocatable would solve the problem. I'm not sure why you don't want to use ALLOCATE. It is a more robust solution, compared to using the stack.
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The heap allocation option is Fortran > Optimization > Heap Arrays - set this to zero. Your problem will likely be solved. There is no way to trap stack overflow and do anything graceful with it.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page