- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My code makes "Segmentation fault". I search this problem in website,so thereforeI have to raise the stack limit. Would you let me know how to increase it? or do you have someoption for compile command? I use the bash shell for RHEL4.0.
Thanks
Message Edited by hydrol88 on 05-23-200603:00 PM
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you believe the SEGV is due to exceeding stack size limit, then you can increase it with bash's builtin ulimit. E.g.,
$ ulimit -s unlimited
OR
$ ulimit -s
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#include
#include
#include
#include
#include
void unlimit_stack_(void) {
struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY };
if ( setrlimit(RLIMIT_STACK, &rlim) == -1 ) {
perror("setrlimit error");
exit(1);
}
}
Yes, a Fortran programmer who can write C too. and here's how to call it from Fortran:
Program main
external unlimit_stack
call unlimit_stack()
...etc...
end
Hope this helps. If not, I have some code to determine at runtime the stacksize seen by your program.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I read your stack size question with interest, since I am having
this problem with the Nasa Overflow 2.0 code (which uses alot of
automatic arrays) and SCALI MPI. I had been stumped about getting
the overflow program to run, since it seemed to die at an area where
is was allocating an automatic array. I found your code
unlimit_stack and added that to the overflow program. The program
now runs to completion without a segfault. I had ulimit -s
unlimited in my submital script (PBS PRO) and in my .bashrc. Any
ideas as to why it would now work using your assembler code and not
the ulimit -s script setting??
Thanx,
Bernie Borenstein
The Boeing Company

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page